This commit is contained in:
mmrbnjd
2024-04-29 07:58:41 +03:30
parent fd13de3e1d
commit 7b8127dc72
23 changed files with 526 additions and 39 deletions

View File

@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shared.DTOs;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace Back.Controllers
{
@@ -59,7 +60,7 @@ namespace Back.Controllers
[HttpPost("CreateCsrAndPrivateKey")]
public async Task<ActionResult<TaxToolsDTO>> CreateCsrAndPrivateKey(CsrPrivateKeyDto model)
{
var resultValidationmodel = await _mobilevalidation.ValidateAsync(model.Mobile);
var resultValidationmodel = await _mobilevalidation.ValidateAsync(Tuple.Create(model.Mobile,false));
if (!resultValidationmodel.IsValid)
return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
return Ok(await _sBase.CreateCsrAndPrivateKey(model));
@@ -167,6 +168,23 @@ namespace Back.Controllers
}
}
[HttpPost("ForgetPassWord")]
[AllowAnonymous]
public async Task<ActionResult<string>> ForgetPassWord(ForgetPasswordItem Item)
{
var resultValidationmodel = await _mobilevalidation.ValidateAsync(Tuple.Create(Item.Username, true));
if (!resultValidationmodel.IsValid)
return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
var ID = await _servValidatinMsg.GenerateCode(new VerificationCode
{
prm = Item.Username,
val = Item.PassWord,
Type = "ForgetPassword"
});
_servSendMsg.Authentication(Item.Username, ID.ToString());
return Ok(ID);
}
}
}