public async Task <GeneratedPasswordModel> GetSuggestedPasswordAsync()
 {
     return(new GeneratedPasswordModel
     {
         Password = await _credentialsGeneratorService.GenerateRandomPasswordForAdminAsync()
     });
 }
示例#2
0
        public async Task <(AdminResetPasswordErrorCodes, Admin)> ResetPasswordAsync(string adminId)
        {
            var result = await _adminManagementServiceClient.AdminsApi.ResetPasswordAsync(
                new ResetPasswordRequestModel
            {
                AdminUserId = adminId,
                Password    = await _credentialsGeneratorService.GenerateRandomPasswordForAdminAsync()
            });

            switch (result.Error)
            {
            case ResetPasswordErrorCodes.None:
                return(AdminResetPasswordErrorCodes.None, _mapper.Map <Admin>(result.Profile));

            case ResetPasswordErrorCodes.AdminUserNotFound:
                return(AdminResetPasswordErrorCodes.AdminUserDoesNotExist, null);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }