diff --git a/RMuseum/appsettings.json b/RMuseum/appsettings.json index fa886067..8e12eb14 100644 --- a/RMuseum/appsettings.json +++ b/RMuseum/appsettings.json @@ -65,8 +65,7 @@ "CurrentSoundFilesFolder": "a2" }, "SignUp": { - "Enabled": "True", - "VerifyEmail": "False" + "Enabled": "True" }, "Donations": { "ShowAccountInfo": "True" diff --git a/RSecurityBackend/Controllers/AppUserControllerBase.cs b/RSecurityBackend/Controllers/AppUserControllerBase.cs index df7ebf22..d2b94001 100644 --- a/RSecurityBackend/Controllers/AppUserControllerBase.cs +++ b/RSecurityBackend/Controllers/AppUserControllerBase.cs @@ -946,25 +946,20 @@ namespace RSecurityBackend.Controllers return BadRequest(res.ExceptionString); } - if (VerifyEmailOnSignUp) + try { - try - { - await _emailSender.SendEmailAsync - ( - signUpViewModel.Email, - _appUserService.GetEmailSubject(RVerifyQueueType.SignUp, res.Result.Secret), - _appUserService.GetEmailHtmlContent(RVerifyQueueType.SignUp, res.Result.Secret, signUpViewModel.CallbackUrl) - ); - return Ok("verify"); - } - catch (Exception exp) - { - return BadRequest("Error sending email: " + exp.ToString()); - } + await _emailSender.SendEmailAsync + ( + signUpViewModel.Email, + _appUserService.GetEmailSubject(RVerifyQueueType.SignUp, res.Result.Secret), + _appUserService.GetEmailHtmlContent(RVerifyQueueType.SignUp, res.Result.Secret, signUpViewModel.CallbackUrl) + ); + return Ok("verify"); + } + catch (Exception exp) + { + return BadRequest("Error sending email: " + exp.ToString()); } - - return Ok("finalize"); } /// @@ -1085,17 +1080,6 @@ namespace RSecurityBackend.Controllers } } - /// - /// verify email on signup - /// - public bool VerifyEmailOnSignUp - { - get - { - return bool.Parse(Configuration.GetSection("SignUp")["VerifyEmail"]); - } - } - /// /// reset password /// diff --git a/RSecurityBackend/RSecurityBackend.xml b/RSecurityBackend/RSecurityBackend.xml index 9f58d82b..d29fc9fb 100644 --- a/RSecurityBackend/RSecurityBackend.xml +++ b/RSecurityBackend/RSecurityBackend.xml @@ -262,11 +262,6 @@ - - - verify email on signup - - reset password @@ -2874,11 +2869,6 @@ associated email - - - verify email on signup - - finalize signup process using email diff --git a/RSecurityBackend/Services/Implementation/AppUserService.cs b/RSecurityBackend/Services/Implementation/AppUserService.cs index 79664282..cfe16205 100644 --- a/RSecurityBackend/Services/Implementation/AppUserService.cs +++ b/RSecurityBackend/Services/Implementation/AppUserService.cs @@ -1140,17 +1140,6 @@ namespace RSecurityBackend.Services.Implementation } - /// - /// verify email on signup - /// - public bool VerifyEmailOnSignUp - { - get - { - return bool.Parse(Configuration.GetSection("SignUp")["VerifyEmail"]); - } - } - /// /// finalize signup process using email /// @@ -1174,18 +1163,13 @@ namespace RSecurityBackend.Services.Implementation return new RServiceResult(false, "این نام کاربری قبلا استفاده شده است"); } - bool verify = VerifyEmailOnSignUp; - - if (verify) + if ( + email + != + (await RetrieveEmailFromQueueSecret(RVerifyQueueType.SignUp, secret)).Result + ) { - if ( - email - != - (await RetrieveEmailFromQueueSecret(RVerifyQueueType.SignUp, secret)).Result - ) - { - return new RServiceResult(false, "کد ارسالی به ایمیل اشتباه وارد شده است"); - } + return new RServiceResult(false, "کد ارسالی به ایمیل اشتباه وارد شده است"); } secret = secret.Trim(); @@ -1216,11 +1200,9 @@ namespace RSecurityBackend.Services.Implementation { return new RServiceResult(false, userAddResult.ExceptionString); } - if (verify) - { - userAddResult.Result.EmailConfirmed = true; - await _userManager.UpdateAsync(userAddResult.Result); - } + + userAddResult.Result.EmailConfirmed = true; + await _userManager.UpdateAsync(userAddResult.Result); RVerifyQueueItem[] failedQueue = await _context.VerifyQueueItems.Where(i => i.Email == email && i.Secret != secret && i.QueueType == RVerifyQueueType.SignUp).ToArrayAsync(); if (failedQueue.Length != 0) @@ -1617,7 +1599,7 @@ namespace RSecurityBackend.Services.Implementation string opString = op == RVerifyQueueType.SignUp ? "ثبت نام" : op == RVerifyQueueType.ForgotPassword ? "فراموشی رمز" : "حذف کاربر"; return $"لطفا {secretCode} را در صفحهٔ {opString} وارد کنید."; } - + #endregion ///