#190 removing ability to turn off verify email on signup (never really used)
This commit is contained in:
parent
e0b3122c58
commit
983347946d
@ -65,8 +65,7 @@
|
||||
"CurrentSoundFilesFolder": "a2"
|
||||
},
|
||||
"SignUp": {
|
||||
"Enabled": "True",
|
||||
"VerifyEmail": "False"
|
||||
"Enabled": "True"
|
||||
},
|
||||
"Donations": {
|
||||
"ShowAccountInfo": "True"
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1085,17 +1080,6 @@ namespace RSecurityBackend.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verify email on signup
|
||||
/// </summary>
|
||||
public bool VerifyEmailOnSignUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return bool.Parse(Configuration.GetSection("SignUp")["VerifyEmail"]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset password
|
||||
/// </summary>
|
||||
|
||||
@ -262,11 +262,6 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Controllers.AppUserControllerBase.VerifyEmailOnSignUp">
|
||||
<summary>
|
||||
verify email on signup
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RSecurityBackend.Controllers.AppUserControllerBase.ResetPassword(RSecurityBackend.Models.Auth.ViewModels.ResetPasswordViewModel)">
|
||||
<summary>
|
||||
reset password
|
||||
@ -2874,11 +2869,6 @@
|
||||
<param name="secret"></param>
|
||||
<returns>associated email</returns>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Services.Implementation.AppUserService.VerifyEmailOnSignUp">
|
||||
<summary>
|
||||
verify email on signup
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RSecurityBackend.Services.Implementation.AppUserService.FinalizeSignUp(System.String,System.String,System.String,System.String,System.String)">
|
||||
<summary>
|
||||
finalize signup process using email
|
||||
|
||||
@ -1140,17 +1140,6 @@ namespace RSecurityBackend.Services.Implementation
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verify email on signup
|
||||
/// </summary>
|
||||
public bool VerifyEmailOnSignUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return bool.Parse(Configuration.GetSection("SignUp")["VerifyEmail"]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// finalize signup process using email
|
||||
/// </summary>
|
||||
@ -1174,18 +1163,13 @@ namespace RSecurityBackend.Services.Implementation
|
||||
return new RServiceResult<bool>(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<bool>(false, "کد ارسالی به ایمیل اشتباه وارد شده است");
|
||||
}
|
||||
return new RServiceResult<bool>(false, "کد ارسالی به ایمیل اشتباه وارد شده است");
|
||||
}
|
||||
|
||||
secret = secret.Trim();
|
||||
@ -1216,11 +1200,9 @@ namespace RSecurityBackend.Services.Implementation
|
||||
{
|
||||
return new RServiceResult<bool>(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
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user