From 667872a1de11f10f1a4e6b924c978948803c3da3 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Mon, 6 Nov 2023 01:08:53 +0800 Subject: [PATCH] customize configs --- .gitignore | 1 + BlazorDiffusion.ServiceInterface/EmailServices.cs | 6 +++--- BlazorDiffusion.ServiceModel/SmtpConfig.cs | 7 +++---- BlazorDiffusion/Program.cs | 4 ++-- BlazorDiffusion/appsettings.Development.json | 8 ++------ 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index fc0ea19..d67cf2b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ App_Data/ *.userosscache *.sln.docstates *.secrets.cs +*.patch # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/BlazorDiffusion.ServiceInterface/EmailServices.cs b/BlazorDiffusion.ServiceInterface/EmailServices.cs index 6d0eb8a..0e3b70a 100644 --- a/BlazorDiffusion.ServiceInterface/EmailServices.cs +++ b/BlazorDiffusion.ServiceInterface/EmailServices.cs @@ -23,7 +23,7 @@ public object Any(SendEmail request) ? new MailAddress(Config.DevToEmail) : new MailAddress(request.To, request.ToName); - var emailFrom = new MailAddress(Config.DefaultFromEmail, Config.DefaultFromName); + var emailFrom = new MailAddress(Config.FromEmail, Config.FromName); var msg = new MailMessage(emailFrom, emailTo) { @@ -32,9 +32,9 @@ public object Any(SendEmail request) IsBodyHtml = request.BodyHtml != null, }; - if (Config.EchoToEmail != null) + if (Config.Bcc != null) { - msg.Bcc.Add(new MailAddress(Config.EchoToEmail)); + msg.Bcc.Add(new MailAddress(Config.Bcc)); } client.Send(msg); diff --git a/BlazorDiffusion.ServiceModel/SmtpConfig.cs b/BlazorDiffusion.ServiceModel/SmtpConfig.cs index b9201fb..94bcfd4 100644 --- a/BlazorDiffusion.ServiceModel/SmtpConfig.cs +++ b/BlazorDiffusion.ServiceModel/SmtpConfig.cs @@ -2,13 +2,12 @@ public class SmtpConfig { - public string UserId { get; set; } public string Username { get; set; } public string Password { get; set; } public string Host { get; set; } public int Port { get; set; } - public string DefaultFromEmail { get; set; } - public string DefaultFromName { get; set; } + public string FromEmail { get; set; } + public string FromName { get; set; } public string DevToEmail { get; set; } - public string EchoToEmail { get; set; } + public string Bcc { get; set; } } diff --git a/BlazorDiffusion/Program.cs b/BlazorDiffusion/Program.cs index 51beeb3..898a788 100644 --- a/BlazorDiffusion/Program.cs +++ b/BlazorDiffusion/Program.cs @@ -41,8 +41,8 @@ options.SaveTokens = true; }) .AddMicrosoftAccount(options => { /* Create App https://apps.dev.microsoft.com */ - options.ClientId = config["oauth.microsoftgraph.AppId"]!; - options.ClientSecret = config["oauth.microsoftgraph.AppSecret"]!; + options.ClientId = config["oauth.microsof.AppId"]!; + options.ClientSecret = config["oauth.microsof.AppSecret"]!; options.SaveTokens = true; }) .AddIdentityCookies(); diff --git a/BlazorDiffusion/appsettings.Development.json b/BlazorDiffusion/appsettings.Development.json index b3683f9..f7a4269 100644 --- a/BlazorDiffusion/appsettings.Development.json +++ b/BlazorDiffusion/appsettings.Development.json @@ -19,15 +19,11 @@ } }, - "oauth.RedirectUrl": "https://localhost:5001/", - "oauth.CallbackUrl": "https://localhost:5001/signin-{0}", "oauth.facebook.Permissions": [ "email", "public_profile" ], "oauth.facebook.AppId": "231464590266507", "oauth.facebook.AppSecret": "9dd6ce54b4405dd1325d271d2419bc34", "oauth.google.ConsumerKey": "871587245318-ikriaoce2578d67qosmf19eg8m44mh2b.apps.googleusercontent.com", "oauth.google.ConsumerSecret": "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", - "oauth.microsoftgraph.AppId": "ba0d5aec-5e6e-4a7e-b02f-636ffd0111b5", - "oauth.microsoftgraph.AppSecret": "1Qm7Q~9JeytqR7UdKK~USDC7lbk0BOeOUnuks", - "oauth.microsoftgraph.SavePhoto": "true", - "oauth.microsoftgraph.SavePhotoSize": "96x96" + "oauth.microsoft.AppId": "ba0d5aec-5e6e-4a7e-b02f-636ffd0111b5", + "oauth.microsoft.AppSecret": "1Qm7Q~9JeytqR7UdKK~USDC7lbk0BOeOUnuks" }