43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using Common.Dtos.Verification;
|
|
using Hushian.Application.Services;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Hushian.WebApi.Controllers.v1
|
|
{
|
|
[Route("api/v1/[controller]")]
|
|
[ApiController]
|
|
public class VerificationController : ControllerBase
|
|
{
|
|
private readonly VerificationService _verificationService;
|
|
|
|
public VerificationController(VerificationService verificationService)
|
|
{
|
|
_verificationService = verificationService;
|
|
}
|
|
|
|
|
|
//------ UserName by Exper - Mobile by Company
|
|
[HttpGet("ForgetPassword/{input}")]
|
|
public async Task<ActionResult<int>> GetIDAndSendCodeForForgetPasswordByUserID(string input)
|
|
{
|
|
var response = await _verificationService.GenerateCodeByForgetPassword(input);
|
|
return response > 0 ? Ok(response)
|
|
: BadRequest(new List<string> { "خطا در ارسال کد احراز"});
|
|
}
|
|
[HttpGet("ReSendCode/{ID}")]
|
|
public async Task<ActionResult<int>> ReSendCodeByID(int ID)
|
|
{
|
|
var response = await _verificationService.ReSendCode(ID);
|
|
return response ? NoContent()
|
|
: BadRequest(new List<string> { "خطا در ارسال کد احراز" });
|
|
}
|
|
[HttpPost("ConfirmedCode")]
|
|
public async Task<ActionResult> ConfirmedCode(ConfirmedCodeDto model)
|
|
{
|
|
var response = await _verificationService.VerificationCode(model);
|
|
return response.Success ? NoContent()
|
|
: BadRequest(response.Errors);
|
|
}
|
|
}
|
|
}
|