diff --git a/Yavsc/Controllers/AccountController.cs b/Yavsc/Controllers/AccountController.cs index c292954c..8b73bbd1 100644 --- a/Yavsc/Controllers/AccountController.cs +++ b/Yavsc/Controllers/AccountController.cs @@ -15,6 +15,7 @@ using Yavsc.Models; using Yavsc.Services; using Yavsc.ViewModels.Account; using Yavsc.Helpers; +using Microsoft.Extensions.Localization; namespace Yavsc.Controllers { @@ -30,6 +31,8 @@ namespace Yavsc.Controllers SmtpSettings _smtpSettings; TwilioSettings _twilioSettings; + IStringLocalizer _localizer; + // TwilioSettings _twilioSettings; public AccountController( @@ -38,7 +41,8 @@ namespace Yavsc.Controllers IEmailSender emailSender, IOptions siteSettings, IOptions smtpSettings, - ILoggerFactory loggerFactory, IOptions twilioSettings) + ILoggerFactory loggerFactory, IOptions twilioSettings, + IStringLocalizer localizer) { _userManager = userManager; _signInManager = signInManager; @@ -49,6 +53,7 @@ namespace Yavsc.Controllers _smtpSettings = smtpSettings.Value; _twilioSettings = twilioSettings.Value; _logger = loggerFactory.CreateLogger(); + _localizer = localizer; } @@ -335,10 +340,14 @@ namespace Yavsc.Controllers { if (ModelState.IsValid) { - var user = await _userManager.FindByNameAsync(model.Email); + var user = await _userManager.FindByEmailAsync(model.Email); if (user == null || !(await _userManager.IsEmailConfirmedAsync(user))) { // Don't reveal that the user does not exist or is not confirmed + if (user == null) + _logger.LogWarning($"ForgotPassword: Email {model.Email} not found"); + else + _logger.LogWarning($"ForgotPassword: Email {model.Email} not confirmed"); return View("ForgotPasswordConfirmation"); } @@ -346,8 +355,8 @@ namespace Yavsc.Controllers // Send an email with this link var code = await _userManager.GeneratePasswordResetTokenAsync(user); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme); - await _emailSender.SendEmailAsync(_siteSettings,_smtpSettings,model.Email, "Reset Password", - "Please reset your password by clicking here: link"); + await _emailSender.SendEmailAsync(_siteSettings,_smtpSettings,model.Email, _localizer["Reset Password"], + _localizer["Please reset your password by followin this link:"] + callbackUrl ); return View("ForgotPasswordConfirmation"); } @@ -366,7 +375,7 @@ namespace Yavsc.Controllers // // GET: /Account/ResetPassword [HttpGet] - public IActionResult ResetPassword(string code = null) + public IActionResult ResetPassword(string UserId, string code = null) { return code == null ? View("Error") : View(); } @@ -381,7 +390,7 @@ namespace Yavsc.Controllers { return View(model); } - var user = await _userManager.FindByNameAsync(model.Email); + var user = await _userManager.FindByEmailAsync(model.Email); if (user == null) { // Don't reveal that the user does not exist diff --git a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.en.resx b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.en.resx index f0401f82..1d1d1187 100644 --- a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.en.resx +++ b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.en.resx @@ -251,9 +251,11 @@ Person Photo Photo updated + Please check your email to reset your password. Please confirm your new password Please fill in a body Please, fill in a reason + Posted Prefered date prestation diff --git a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx index 719872c8..c3f46a15 100644 --- a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx +++ b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx @@ -194,6 +194,7 @@ Date de fin Heure de fin e-mail + Saisissez votre email. entrées Estimer Devis non trouvé @@ -205,8 +206,8 @@ Veuillez, s'il vous plait, utiliser une date future. Saisissez votre demande de rendez-vous Contenu à accès restreint - - Mot de passe oublié + Mot de passe perdu? + Confirmation mot de passe perdu. provenant de L'envoi du message push a échoué Message push envoyé @@ -273,9 +274,11 @@ Personne Photo Photo mise à jour + S'il vous plait, veuillez verifier votre boite au lettres, pour pouvoir ré-initialiser votre mot de passe. S'il vous plait, veuillez confirmer votre nouveau mot de passe. S'il vous plait, saisissez un corps de message S'il vous plait, saisissez une réson, un sujet pour votre message + Veuillez s'il vous plait utiliser le lien suivant pour ré-initialiser votre mot de passe: Posté Date souhaitée Lieu de la présation: {0}.\n @@ -297,7 +300,7 @@ Supprimer Supprimer mon profile professionnel Rôle - Ré-initialiser votre mot de passe + Ré-initialiser votre mot de passe Rôle créé Nom du rôle Save these settings @@ -357,5 +360,4 @@ Vos publications Votre profile Votre messge a été envoyé - diff --git a/Yavsc/Views/Account/ForgotPassword.cshtml b/Yavsc/Views/Account/ForgotPassword.cshtml index b7b27c8d..93e0276b 100755 --- a/Yavsc/Views/Account/ForgotPassword.cshtml +++ b/Yavsc/Views/Account/ForgotPassword.cshtml @@ -1,12 +1,12 @@ @model ForgotPasswordViewModel @{ - ViewData["Title"] = "Forgot your password?"; + ViewData["Title"] = SR["Forgot your password?"]; } -

@ViewData["Title"].

+

@ViewData["Title"]

-

Enter your email.

+

@SR["Enter your email."]


@@ -18,7 +18,7 @@
- +
diff --git a/Yavsc/Views/Account/ForgotPasswordConfirmation.cshtml b/Yavsc/Views/Account/ForgotPasswordConfirmation.cshtml index c7296dea..b2fbb50c 100755 --- a/Yavsc/Views/Account/ForgotPasswordConfirmation.cshtml +++ b/Yavsc/Views/Account/ForgotPasswordConfirmation.cshtml @@ -1,8 +1,8 @@ @{ - ViewData["Title"] = "Forgot Password Confirmation"; + ViewData["Title"] = @SR["Forgot Password Confirmation."]; }

@ViewData["Title"].

- Please check your email to reset your password. + @SR["PleaseCheckYourEmail"]

diff --git a/Yavsc/Views/Shared/SignIn.cshtml b/Yavsc/Views/Shared/SignIn.cshtml index 468b07fe..1583ffb4 100644 --- a/Yavsc/Views/Shared/SignIn.cshtml +++ b/Yavsc/Views/Shared/SignIn.cshtml @@ -45,7 +45,7 @@ @SR["Register as a new user"]?

- @SR["Forgot your password"]? + @SR["Forgot your password?"]