diff --git a/External/Implementations/UserConfigDataAccess.cs b/External/Implementations/UserConfigDataAccess.cs index 83003b7..7d63103 100644 --- a/External/Implementations/UserConfigDataAccess.cs +++ b/External/Implementations/UserConfigDataAccess.cs @@ -32,7 +32,8 @@ namespace CarCareTracker.External.Implementations using (var db = new LiteDatabase(dbName)) { var table = db.GetCollection(tableName); - return table.Delete(userId); + table.Delete(userId); + return true; }; } } diff --git a/Helper/MailHelper.cs b/Helper/MailHelper.cs index ed86618..6915f1d 100644 --- a/Helper/MailHelper.cs +++ b/Helper/MailHelper.cs @@ -20,6 +20,10 @@ namespace CarCareTracker.Helper } public OperationResponse NotifyUserForRegistration(string emailAddress, string token) { + if (string.IsNullOrWhiteSpace(mailConfig.EmailServer)) + { + return new OperationResponse { Success = false, Message = "SMTP Server Not Setup" }; + } if (string.IsNullOrWhiteSpace(emailAddress) || string.IsNullOrWhiteSpace(token)) { return new OperationResponse { Success = false, Message = "Email Address or Token is invalid" }; } @@ -36,6 +40,10 @@ namespace CarCareTracker.Helper } public OperationResponse NotifyUserForPasswordReset(string emailAddress, string token) { + if (string.IsNullOrWhiteSpace(mailConfig.EmailServer)) + { + return new OperationResponse { Success = false, Message = "SMTP Server Not Setup" }; + } if (string.IsNullOrWhiteSpace(emailAddress) || string.IsNullOrWhiteSpace(token)) { return new OperationResponse { Success = false, Message = "Email Address or Token is invalid" }; diff --git a/Views/Admin/Index.cshtml b/Views/Admin/Index.cshtml index 171553a..81bba62 100644 --- a/Views/Admin/Index.cshtml +++ b/Views/Admin/Index.cshtml @@ -1,6 +1,15 @@ @{ ViewData["Title"] = "Admin"; } +@inject IConfiguration config; +@{ + bool emailServerIsSetup = true; + var mailConfig = config.GetSection("MailConfig").Get(); + if (mailConfig is null || string.IsNullOrWhiteSpace(mailConfig.EmailServer)) + { + emailServerIsSetup = false; + } +} @model AdminViewModel
@@ -22,7 +31,7 @@
- +