implement password policy endpoints
This commit is contained in:
parent
6cd0f8f82f
commit
1a264523a0
|
|
@ -227,3 +227,14 @@ public class GetMaterialStockReponse
|
||||||
public string MaterialCode { get; set; }
|
public string MaterialCode { get; set; }
|
||||||
public decimal AvailableStock { get; set; }
|
public decimal AvailableStock { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetPasswordPolicyResponse
|
||||||
|
{
|
||||||
|
public int MinLength { get; set; }
|
||||||
|
public int MaxLength { get; set; }
|
||||||
|
public int IsUppercase { get; set; }
|
||||||
|
public int IsLowercase { get; set; }
|
||||||
|
public int IsNumber { get; set; }
|
||||||
|
public int IsSpecialCharacter { get; set; }
|
||||||
|
public int PasswordLife { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -21,4 +21,5 @@ public interface IMobileMasterDataService
|
||||||
Task<PagedResult<GetFOCResponse>> GetFOCsAsync(GetFOCRequest request);
|
Task<PagedResult<GetFOCResponse>> GetFOCsAsync(GetFOCRequest request);
|
||||||
Task<PagedResult<GetFOCMaterialResponse>> GetFOCMaterialsAsync(GetFOCMaterialRequest request);
|
Task<PagedResult<GetFOCMaterialResponse>> GetFOCMaterialsAsync(GetFOCMaterialRequest request);
|
||||||
Task<PagedResult<GetPaymentTermResponse>> GetPaymentTermsAsync(GetPaymentTermRequest request);
|
Task<PagedResult<GetPaymentTermResponse>> GetPaymentTermsAsync(GetPaymentTermRequest request);
|
||||||
|
Task<GetPasswordPolicyResponse> GetPasswordPolicyAsync();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -981,5 +981,49 @@ public class MobileMasterDataService : IMobileMasterDataService
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<GetPasswordPolicyResponse> GetPasswordPolicyAsync()
|
||||||
|
{
|
||||||
|
GetPasswordPolicyResponse response = new();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using TransactionContext tc = await TransactionContext.BeginAsync(_settings.DefaultConnection.ConnectionNode);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlParameter[] p =[];
|
||||||
|
|
||||||
|
using (IDataReader dr = await tc.ExecuteReaderSpAsync("dbo.GetPaymentTermsPaginated", parameterValues: p))
|
||||||
|
{
|
||||||
|
if (dr.Read())
|
||||||
|
{
|
||||||
|
new GetPasswordPolicyResponse()
|
||||||
|
{
|
||||||
|
MinLength = dr.GetInt32(0),
|
||||||
|
MaxLength = dr.GetInt32(1),
|
||||||
|
IsUppercase = dr.GetInt32(2),
|
||||||
|
IsLowercase = dr.GetInt32(3),
|
||||||
|
IsSpecialCharacter = dr.GetInt32(4),
|
||||||
|
IsNumber = dr.GetInt32(5),
|
||||||
|
PasswordLife = dr.GetInt32(6),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
dr.Close();
|
||||||
|
}
|
||||||
|
tc.End();
|
||||||
|
}
|
||||||
|
catch (Exception ie)
|
||||||
|
{
|
||||||
|
tc?.HandleError();
|
||||||
|
|
||||||
|
throw DBCustomError.GenerateCustomError(ie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -385,5 +385,31 @@ namespace OnlineSalesAutoCrop.CoreAPI.Controllers
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, MobileResponseBase<AppAuthUserResponse>.Failure(ex.InnerException != null ? ex.InnerException.Message : ex.Message, StatusCodes.Status500InternalServerError));
|
return StatusCode(StatusCodes.Status500InternalServerError, MobileResponseBase<AppAuthUserResponse>.Failure(ex.InnerException != null ? ex.InnerException.Message : ex.Message, StatusCodes.Status500InternalServerError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For PasswordPolicy
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// </remarks>
|
||||||
|
/// <response code="200">If login successful Return Attendance List</response>
|
||||||
|
[HttpGet("PasswordPolicy")]
|
||||||
|
[IgnoreAntiforgeryToken]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GetPasswordPolicyResponse))]
|
||||||
|
public async Task<IActionResult> GetPasswordPolicy()
|
||||||
|
{
|
||||||
|
GetPasswordPolicyResponse response = new();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = await _service.GetPasswordPolicyAsync();
|
||||||
|
return Ok(MobileResponseBase<GetPasswordPolicyResponse>.Success(response));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string msg = $"Exception occur on Get PasswordPolicy endpoint ";
|
||||||
|
_logger.LogError(exception: ex, message: msg);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, MobileResponseBase<AppAuthUserResponse>.Failure(ex.InnerException != null ? ex.InnerException.Message : ex.Message, StatusCodes.Status500InternalServerError));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user