Jelszó módosítása

This commit is contained in:
2025-04-14 12:31:50 +02:00
parent 44e6719c3d
commit 29200ae418
18 changed files with 676 additions and 9 deletions
+43 -1
View File
@@ -195,6 +195,48 @@ namespace WorkFlowCheck.Web.Services
};
}
}
public async Task<ApiResponseDTO<UserDTO>> Authenticate2F2ChangePassword(string username, string oldpassword, string newpassword, string code, string token2FA)
{
try
{
string endpoint = $"{_httpClient.BaseAddress}api/User/Authenticate2F2ChangePassword";
var userSimpleDTO = new UserChangePassword2FADTO()
{
UserName = username,
OldPassword = oldpassword,
NewPassword1 = newpassword,
NewPassword2 = newpassword,
Code = code,
Token2FA = token2FA
};
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, userSimpleDTO))
{
httpResponseMessage.EnsureSuccessStatusCode();
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
var response = JsonConvert.DeserializeObject<ApiResponseDTO<UserDTO>>(jsonString);
return response ?? new ApiResponseDTO<UserDTO>
{
IsSuccess = false,
};
}
}
catch (Exception ex)
{
return new ApiResponseDTO<UserDTO>
{
IsSuccess = false
};
}
}
public async Task<bool> DeleteUser(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteUser/{id}";
@@ -522,6 +564,6 @@ namespace WorkFlowCheck.Web.Services
}
}
}
}