This commit is contained in:
mmrbnjd
2025-07-26 11:47:32 +03:30
parent 29107ce9c6
commit c045ace959
10 changed files with 88 additions and 64 deletions

View File

@@ -6,6 +6,8 @@
@inject NavigationManager NavigationManager
@inject AuthService authService;
@inject ILocalStorageService localStorageService;
@inject CompanyService companyService
<form style="background-color: #ffffff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column;">
<label style="margin-bottom: 8px; font-size: 14px; color: #333;" for="oldpass">رمز عبور قبلی:</label>
@@ -52,7 +54,7 @@
return;
}
List<string> errors = new();
List<string> errors = new();
if (!dto.NewPassWord.CheckLawPassword(ref errors))
{
ToastService.Notify(new(ToastType.Danger, errors.First()));
@@ -60,7 +62,15 @@
}
SpinnerVisible = true;
var result = await userService.ChangePasswordYourself(dto);
var result = false;
string Role = await localStorageService.GetItem<string>("C/Role");
if (Role == "Company")
result = await companyService.ChangePasswordCompany(dto);
else if (Role == "Exper")
result = await userService.ChangePasswordYourself(dto);
if (result)
{
ToastService.Notify(new ToastMessage(ToastType.Success, "تغییر کلمه عبور با موفقیت انجام شد"));

View File

@@ -27,12 +27,12 @@
public Update_ExperDto model { get; set; } = new();
protected override async Task OnInitializedAsync()
{
var user=await userService.GetCurrentUser();
var user = await userService.GetCurrentExper();
if (user!=null)
{
model.FullName = user.FullName;
Role = await localStorageService.GetItem<string>("Role");
Role = await localStorageService.GetItem<string>("C/Role");
isAuthorizedCompanyUser = Role=="Exper" && await userService.CheckAvailableExperInCompany();
}
else