diff --git a/DagoniteEmpire/Areas/Identity/Pages/Account/Login.cshtml b/DagoniteEmpire/Areas/Identity/Pages/Account/Login.cshtml index 6354164..fb5f30e 100644 --- a/DagoniteEmpire/Areas/Identity/Pages/Account/Login.cshtml +++ b/DagoniteEmpire/Areas/Identity/Pages/Account/Login.cshtml @@ -46,7 +46,7 @@ -
+ @*

Use another service to log in.


@@ -75,7 +75,7 @@ } }
-
+
*@ @section Scripts { diff --git a/DagoniteEmpire/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs b/DagoniteEmpire/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs index 72c1d4c..b9ad89c 100644 --- a/DagoniteEmpire/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs +++ b/DagoniteEmpire/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs @@ -60,7 +60,7 @@ public async Task OnGetAsync(string email, string returnUrl = nul Email = email; // Once you add a real email sender, you should remove this code that lets you confirm the account - DisplayConfirmAccountLink = true; + DisplayConfirmAccountLink = false; if (DisplayConfirmAccountLink) { var userId = await _userManager.GetUserIdAsync(user); diff --git a/DagoniteEmpire/DagoniteEmpire.csproj b/DagoniteEmpire/DagoniteEmpire.csproj index cef407e..d370b0b 100644 --- a/DagoniteEmpire/DagoniteEmpire.csproj +++ b/DagoniteEmpire/DagoniteEmpire.csproj @@ -19,11 +19,14 @@ + + + diff --git a/DagoniteEmpire/Helper/EmailConfiguration.cs b/DagoniteEmpire/Helper/EmailConfiguration.cs new file mode 100644 index 0000000..a4a54f0 --- /dev/null +++ b/DagoniteEmpire/Helper/EmailConfiguration.cs @@ -0,0 +1,13 @@ +namespace DagoniteEmpire.Helper +{ + public class EmailConfiguration + { + public string Host { get; set; } = string.Empty; + public int Port { get; set; } + public string Username { get; set; } = string.Empty; + public string Password { get; set; } = string.Empty; + public string From { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public bool EnableSSL { get; set; } + } +} diff --git a/DagoniteEmpire/Helper/EmailMessage.cs b/DagoniteEmpire/Helper/EmailMessage.cs new file mode 100644 index 0000000..9a6c2bd --- /dev/null +++ b/DagoniteEmpire/Helper/EmailMessage.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace DagoniteEmpire.Helper +{ + public class EmailMessage + { + [EmailAddress] + public string Email { get; set; } = string.Empty; + + [Required] + public string Subject { get; set; } = string.Empty; + + [Required] + public string Message { get; set; } = string.Empty; + } +} diff --git a/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor b/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor index 9c6e4cd..0f50553 100644 --- a/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor +++ b/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor @@ -64,9 +64,9 @@
-
+
- + @* *@

PORTRAIT

@@ -87,10 +87,10 @@
- -
+ +
- + @* *@

ATTRIBUTES

@@ -155,9 +155,9 @@
-
+
- + @* *@

BASE SKILLS

@@ -213,18 +213,18 @@
-
+
-
+
-
+
- + @* *@

TRAITS

@@ -232,7 +232,7 @@
-
+
@@ -248,9 +248,9 @@ @foreach (var baseSkill in BaseSkills) { -
+
- + @* *@
@@ -275,7 +275,7 @@ @if (obj.Editable) { - + } else { @@ -287,7 +287,7 @@ @if (obj.Editable) { - + } else { @@ -394,13 +394,13 @@ background: transparent; } - .e-richtexteditor.e-rte-tb-expand .e-rte-content, .e-richtexteditor.e-rte-tb-expand .e-source-content{ + /* .e-richtexteditor.e-rte-tb-expand .e-rte-content, .e-richtexteditor.e-rte-tb-expand .e-source-content{ border: 1px solid black; } .e-richtexteditor.e-rte-tb-expand{ border: none; - } + } */ diff --git a/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor.css b/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor.css index bbb54b0..81101da 100644 --- a/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor.css +++ b/DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor.css @@ -4,6 +4,12 @@ padding: 0; } +.border { + border: 1px solid rgb(72, 69, 69); + border-radius: 10px; + margin: 6px; +} + .loading-gif{ width:100px; } @@ -25,7 +31,7 @@ h3 { } .bonus-row { - width: 18px;F + width: 18px; font-size: 13px; text-align: left; padding: 2px; @@ -42,7 +48,7 @@ h3 { font-size: 13px; width: 40px; text-align: left; - padding: 5px; + padding: 2px; vertical-align: middle; } @@ -116,7 +122,7 @@ td { justify-content: center; align-items: center; padding: 5px 5px 0px 5px; - border: 1px solid black; + border: 1px solid RGB(206 212 218); border-radius: 4px; /*width: 320px;*/ height: 390px; @@ -158,9 +164,9 @@ td { width: 100%; padding: 30px; text-align: center; - background-color: wheat; + background-color: transparent; color: black; - border: 1px solid gray; + border: 1px solid RGB(206 212 218); border-radius: 10px; cursor: pointer; } @@ -201,9 +207,7 @@ i:active { padding: 2px; letter-spacing: 1px; } -.attribute .bonus-row { - padding: 5px; -} + .attribute td { padding: 2px; @@ -370,7 +374,7 @@ i:active { } .add-skill { - background-color: darkgray; + background-color: transparent; border: 1px solid black; border-radius: 3px; } @@ -452,11 +456,11 @@ i:active { } .table tr th { - border-bottom: 1px solid black; /* Change the color you want to set */ + /*border-bottom: 1px solid black; */ } .table tr td { - border-bottom: 1px solid black; /* Change the color you want to set */ + /* border-bottom: 1px solid black;*/ } diff --git a/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor b/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor index 762d57e..dda4981 100644 --- a/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor +++ b/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor @@ -1,7 +1,7 @@ 
- + @* *@

DESCRIPTION

diff --git a/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor.css b/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor.css index 0104b00..7e5fed1 100644 --- a/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor.css +++ b/DagoniteEmpire/Pages/Components/CharDescriptionDialog.razor.css @@ -37,13 +37,13 @@ h3 { } .add-trait { - border: none; - border-radius: 3px; - width: 170px; - height: 35px; - margin: 5px 0 10px 0; - background-color: transparent; - background-image: url('../images/buttonFrame1.png'); + border: 1px solid black; + border-radius: 6px; + width: 120px; + height: 32px; + margin: 5px 5px 10px 5px; + background-color: transparent; /* + background-image: url('../images/buttonFrame1.png');*/ position: relative; background-size: cover; background-position: center; diff --git a/DagoniteEmpire/Pages/Components/ProfessionComponent.razor b/DagoniteEmpire/Pages/Components/ProfessionComponent.razor index 1082349..9972a2b 100644 --- a/DagoniteEmpire/Pages/Components/ProfessionComponent.razor +++ b/DagoniteEmpire/Pages/Components/ProfessionComponent.razor @@ -1,9 +1,9 @@ 
- + @* *@

CLASS

- + diff --git a/DagoniteEmpire/Pages/Components/ProfessionComponent.razor.css b/DagoniteEmpire/Pages/Components/ProfessionComponent.razor.css index d78ce99..b522e52 100644 --- a/DagoniteEmpire/Pages/Components/ProfessionComponent.razor.css +++ b/DagoniteEmpire/Pages/Components/ProfessionComponent.razor.css @@ -56,17 +56,17 @@ h3 { } .add-trait { - border: none; - border-radius: 3px; - width: 170px; - height: 35px; - margin: 5px 0 10px 0; - background-color: transparent; - background-image: url('../images/buttonFrame1.png'); + border: 1px solid black; + border-radius: 6px; + width: 120px; + height: 32px; + margin: 5px 5px 10px 5px; + background-color: transparent; /* + background-image: url('../images/buttonFrame1.png');*/ position: relative; background-size: cover; background-position: center; - font-weight:bold; + font-weight: bold; transition: transform 0.1s; } .add-trait:hover { @@ -90,9 +90,9 @@ h3 { } .table tr th { - border-bottom: 1px solid black; /* Change the color you want to set */ + /*border-bottom: 1px solid black;*/ } .table tr td { - border-bottom: 1px solid black; /* Change the color you want to set */ + /* border-bottom: 1px solid black; */ } diff --git a/DagoniteEmpire/Pages/Components/RaceComponent.razor b/DagoniteEmpire/Pages/Components/RaceComponent.razor index 545166b..ce3ab63 100644 --- a/DagoniteEmpire/Pages/Components/RaceComponent.razor +++ b/DagoniteEmpire/Pages/Components/RaceComponent.razor @@ -1,9 +1,9 @@ 
- + @* *@

RACE

- @@ -16,11 +16,11 @@ @if (ShowNameLabel) { - + }
- +
diff --git a/DagoniteEmpire/Pages/Components/RaceComponent.razor.css b/DagoniteEmpire/Pages/Components/RaceComponent.razor.css index 991f044..744c3c2 100644 --- a/DagoniteEmpire/Pages/Components/RaceComponent.razor.css +++ b/DagoniteEmpire/Pages/Components/RaceComponent.razor.css @@ -71,6 +71,7 @@ h3 { z-index: -20; } .richtext-conteiner { + max-height:200px; width: 100%; flex: 2; } @@ -85,13 +86,13 @@ h3 { } .add-trait { - border: none; - border-radius: 3px; - width: 170px; - height: 35px; - margin: 5px 0 10px 0; - background-color: transparent; - background-image: url('../images/buttonFrame1.png'); + border: 1px solid black; + border-radius: 6px; + width: 120px; + height: 32px; + margin: 5px 5px 10px 5px; + background-color: transparent; /* + background-image: url('../images/buttonFrame1.png');*/ position: relative; background-size: cover; background-position: center; @@ -101,4 +102,12 @@ h3 { .add-trait:hover { transform: scale(1.1) - } \ No newline at end of file + } + +.table tr th { + /*border-bottom: 1px solid black;*/ +} + +.table tr td { + /*border-bottom: 1px solid black;*/ +} \ No newline at end of file diff --git a/DagoniteEmpire/Pages/Components/TraitsComponent.razor b/DagoniteEmpire/Pages/Components/TraitsComponent.razor index 386f0d8..31ce66b 100644 --- a/DagoniteEmpire/Pages/Components/TraitsComponent.razor +++ b/DagoniteEmpire/Pages/Components/TraitsComponent.razor @@ -31,8 +31,8 @@ }
} diff --git a/DagoniteEmpire/Pages/Components/TraitsComponent.razor.css b/DagoniteEmpire/Pages/Components/TraitsComponent.razor.css index ef1e074..b673cb2 100644 --- a/DagoniteEmpire/Pages/Components/TraitsComponent.razor.css +++ b/DagoniteEmpire/Pages/Components/TraitsComponent.razor.css @@ -36,13 +36,13 @@ } .add-trait { - border: none; - border-radius: 3px; - width: 170px; - height: 35px; - margin: 5px 0 10px 0; - background-color: transparent; - background-image: url('../images/buttonFrame1.png'); + border: 1px solid black; + border-radius: 6px; + width: 120px; + height: 32px; + margin: 5px 5px 10px 5px; + background-color: transparent; /* + background-image: url('../images/buttonFrame1.png');*/ position: relative; background-size: cover; background-position: center; @@ -50,9 +50,14 @@ transition: transform 0.1s; } - .add-trait:hover { - transform: scale(1.1) - } +.trait-btn-small{ + border: 1px solid darkgray; + border-radius:4px; +} + +.add-trait:hover { + transform: scale(1.1) +} .name-row { font-size: 13px; width: 40px; @@ -82,4 +87,12 @@ td { flex-direction: row; align-items: center; justify-content: center; +} + +.table tr th { + /* border-bottom: 1px solid black; */ +} + +.table tr td { + /* border-bottom: 1px solid black; */ } \ No newline at end of file diff --git a/DagoniteEmpire/Program.cs b/DagoniteEmpire/Program.cs index 761ce1d..9a87350 100644 --- a/DagoniteEmpire/Program.cs +++ b/DagoniteEmpire/Program.cs @@ -13,6 +13,9 @@ using DA_Common; using NLog.Web; using DagoniteEmpire.Middleware; +using DA_DataAccess; +using Microsoft.AspNetCore.Identity.UI.Services; +using DagoniteEmpire.Helper; var builder = WebApplication.CreateBuilder(args); @@ -47,8 +50,15 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddTransient(); +//builder.Services.Configure(builder.Configuration); - +//builder.Services.Configure(o => +// o.TokenLifespan = TimeSpan.FromHours(3)); +builder.Services.Configure(options => +{ + builder.Configuration.GetSection("Email").Bind(options); +}); var app = builder.Build(); diff --git a/DagoniteEmpire/Service/AuthMessageSenderOptions.cs b/DagoniteEmpire/Service/AuthMessageSenderOptions.cs new file mode 100644 index 0000000..6d11478 --- /dev/null +++ b/DagoniteEmpire/Service/AuthMessageSenderOptions.cs @@ -0,0 +1,7 @@ +namespace DagoniteEmpire.Service +{ + public class AuthMessageSenderOptions + { + public string? EmailAuthKey { get; set; } + } +} diff --git a/DagoniteEmpire/Service/EmailSender.cs b/DagoniteEmpire/Service/EmailSender.cs new file mode 100644 index 0000000..ddbc2c7 --- /dev/null +++ b/DagoniteEmpire/Service/EmailSender.cs @@ -0,0 +1,69 @@ +using DA_DataAccess; +using Microsoft.Extensions.Options; +using Microsoft.AspNetCore.Identity.UI.Services; +using MimeKit.Text; +using MimeKit; +using DagoniteEmpire.Helper; +using MailKit.Net.Smtp; + +namespace DagoniteEmpire.Service +{ + + + public class EmailSender : IEmailSender + { + private readonly ILogger _logger; + + private readonly EmailConfiguration _emailConfiguration; + + public EmailSender(IOptions emailConfiguration) + { + this._emailConfiguration = emailConfiguration.Value; + } + + public Task SendEmailAsync(string email, string subject, string htmlMessage) + { + return Execute(email, subject, htmlMessage); + } + + private async Task Execute(string to, string subject, string htmlMessage) + { + string host = _emailConfiguration.Host; + int port = _emailConfiguration.Port; + string username = _emailConfiguration.Username; + string password = _emailConfiguration.Password; + string from = _emailConfiguration.From; + string name = _emailConfiguration.Name; + bool enableSsl = _emailConfiguration.EnableSSL; + + var email = new MimeMessage(); + + var sender = MailboxAddress.Parse(from); + if (!string.IsNullOrEmpty(name)) + sender.Name = name; + email.Sender = sender; + email.From.Add(sender); + email.To.Add(MailboxAddress.Parse(to)); + email.Subject = subject; + email.Body = new TextPart(TextFormat.Html) { Text = htmlMessage }; + + using (var smtp = new SmtpClient()) + { + smtp.Timeout = 10000; // 10secs + try + { + await smtp.ConnectAsync(host, port, enableSsl); + if (!string.IsNullOrEmpty(username)) + smtp.Authenticate(username, password); + await smtp.SendAsync(email); + await smtp.DisconnectAsync(true); + } + catch (Exception ex) + { + throw; + } + } + } + } + +} diff --git a/DagoniteEmpire/appsettings.json b/DagoniteEmpire/appsettings.json index 8d56ceb..1de3eed 100644 --- a/DagoniteEmpire/appsettings.json +++ b/DagoniteEmpire/appsettings.json @@ -5,6 +5,15 @@ "Microsoft.AspNetCore": "Warning" } }, + "Email": { + "Host": "HOST_ADDRESS", + "Port": 587, + "Username": "USERNAME", + "Password": "PASSWORD", + "From": "FROM_EMAIL", + "Name": "FROM_NAME", + "EnableSSL": true + }, "AllowedHosts": "*", "ConnectionStrings": { //"DefaultConnection": "Server=(localDb)\\krystian;Database=DagoniteEmpire;Trusted_Connection=True;",
- - + +