...
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
stroke-linejoin="round" />
|
||||
</svg>
|
||||
|
||||
<span>@userinfo.FullName</span>
|
||||
<span>@userinfo.Company.Name</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
@inject UserAuthenticationDTO userinfo
|
||||
@inject HttpClient _hc
|
||||
@inject NavigationManager nav
|
||||
@inject localService localserv;
|
||||
<HeadContent>
|
||||
<link rel="canonical" href="#">
|
||||
<!-- Favicon -->
|
||||
@@ -199,6 +200,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@functions {
|
||||
private async Task Logout()
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
@page "/Profile"
|
||||
@page "/Profile/{from}"
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@layout PanelLayout
|
||||
@@ -53,19 +54,19 @@
|
||||
<div class="mb-3 row">
|
||||
<label for="defaultFormControlInput" class="form-label">کلمه عبور فعلی</label>
|
||||
<div class="col-md-10">
|
||||
<InputText @bind-Value="@changepassModel.oldPass" style="text-align:center;" class="form-control" type="password" id="html5-password-input"/>
|
||||
<InputText @bind-Value="@changepassModel.oldPass" style="text-align:center;" class="form-control" type="password" id="html5-password-input1"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="defaultFormControlInput" class="form-label">کلمه عبور جدید</label>
|
||||
<div class="col-md-10">
|
||||
<InputText style="text-align:center;" @bind-Value="@changepassModel.newPass" class="form-control" type="password" id="html5-password-input" />
|
||||
<InputText style="text-align:center;" @bind-Value="@changepassModel.newPass" class="form-control" type="password" id="html5-password-input2" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="defaultFormControlInput" class="form-label">تکرار کلمه عبور جدید</label>
|
||||
<div class="col-md-10">
|
||||
<InputText @bind-Value="@changepassModel.renewPass" style="text-align:center;" class="form-control" type="password" id="html5-password-input" />
|
||||
<InputText @bind-Value="@changepassModel.renewPass" style="text-align:center;" class="form-control" type="password" id="html5-password-input3" />
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">ارسال</button>
|
||||
@@ -78,16 +79,16 @@
|
||||
<div class="card mb-4">
|
||||
<h5 class="card-header">تغییر نام کاربری/ موبایل</h5>
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<EditForm Model="newUsername" OnSubmit="changeUserNameSubmit" FormName="changeUsername">
|
||||
<div class="mb-3 row">
|
||||
<label for="defaultFormControlInput" class="form-label">موبایل جدید</label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input type="text" style="text-align:left;" id="basic-icon-default-phone" class="form-control phone-mask" placeholder="0000 000 0911" aria-label="0000 000 0911" value="@userinfo.UserName" aria-describedby="basic-icon-default-phone2">
|
||||
<InputText @bind-Value="@newUsername" type="text" style="text-align:left;" id="basic-icon-default-phone" class="form-control phone-mask" placeholder="0000 000 0911" aria-label="0000 000 0911" aria-describedby="basic-icon-default-phone2"/>
|
||||
<span id="basic-icon-default-phone2" class="input-group-text"><i class="bx bx-phone"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">ارسال</button>
|
||||
</form>
|
||||
</EditForm>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,16 +99,16 @@
|
||||
<div class="card mb-4">
|
||||
<h5 class="card-header">تغییر نام</h5>
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<EditForm Model="newname" OnSubmit="changeNameSubmit" FormName="changename">
|
||||
<div class="mb-3 row">
|
||||
<label for="defaultFormControlInput" class="form-label">نام جدید</label>
|
||||
<div class="input-group input-group-merge">
|
||||
<span id="basic-icon-default-company2" class="input-group-text"><i class="bx bx-buildings"></i></span>
|
||||
<input style="text-align:right;" type="text" id="basic-icon-default-company" value="@userinfo.Company.Name" class="form-control" placeholder="@userinfo.Company.Name" aria-label="@userinfo.Company.Name" aria-describedby="basic-icon-default-company2">
|
||||
<InputText @bind-Value="@newname" style="text-align:right;" type="text" id="basic-icon-default-company" class="form-control" placeholder="@userinfo.Company.Name" aria-label="@userinfo.Company.Name" aria-describedby="basic-icon-default-company2"/>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">ارسال</button>
|
||||
</form>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -118,17 +119,37 @@
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string from { get; set; } = "";
|
||||
|
||||
public string _src { get; set; }
|
||||
private long maxFileSize = 1024 * 15;
|
||||
[SupplyParameterFromForm]
|
||||
public ChangePasswordDto changepassModel { get; set; }
|
||||
[SupplyParameterFromForm]
|
||||
public string newUsername { get; set; }
|
||||
[SupplyParameterFromForm]
|
||||
public string newname { get; set; }
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (from == "Verification")
|
||||
{
|
||||
ShowSuccessAlert("تغییر کاربری با موفقیت انجام شد");
|
||||
}
|
||||
|
||||
protected override void OnInitialized() => changepassModel ??= new();
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
newname ??= userinfo.Company.Name;
|
||||
newUsername ??= userinfo.UserName;
|
||||
changepassModel ??= new();
|
||||
}
|
||||
}
|
||||
@functions{
|
||||
private void ShowDangerAlert(string msg)
|
||||
@@ -163,6 +184,54 @@
|
||||
ShowDangerAlert(errors[0]);
|
||||
}
|
||||
}
|
||||
private async Task changeUserNameSubmit()
|
||||
{
|
||||
if (newUsername != userinfo.UserName)
|
||||
{
|
||||
var request = await _hc.Get($"User/ChangeUserName/{newUsername}");
|
||||
if (request.IsSuccessStatusCode)
|
||||
{
|
||||
var VerificationID = await request.Content.ReadFromJsonAsync<int>();
|
||||
_hc._nav.NavigateTo($"Verification/{VerificationID}");
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var errors = await request.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(errors[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private async Task changeNameSubmit()
|
||||
{
|
||||
if (newname != userinfo.Company.Name)
|
||||
{
|
||||
var request = await _hc.Get($"Company/ChangeName/{newname}");
|
||||
if (request.IsSuccessStatusCode)
|
||||
{
|
||||
if (await request.Content.ReadFromJsonAsync<bool>())
|
||||
{
|
||||
userinfo.FullName= userinfo.Company.Name = newname;
|
||||
ShowSuccessAlert("تغییر نام با موفقیت انجام شد");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var errors = await request.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(errors[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private async Task changePic(InputFileChangeEventArgs e){
|
||||
if (e.GetMultipleFiles()[0].Size <= maxFileSize)
|
||||
{
|
||||
@@ -188,7 +257,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert ( "خطایی در اجرای عملیات رخ داده");
|
||||
ShowDangerAlert( "خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,4 +266,5 @@
|
||||
ShowDangerAlert ( "حجم فایل بیشتر از حد مجاز می باشد");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
@page "/Verification/{ID:int}"
|
||||
@inject HttpClient _hc
|
||||
@inject NavigationManager nav
|
||||
@inject UserAuthenticationDTO userinfo
|
||||
<PageTitle>احراز هویت</PageTitle>
|
||||
<main>
|
||||
|
||||
@@ -123,7 +124,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert(await request.Content.ReadFromJsonAsync<string>());
|
||||
var listerror = await request.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(listerror[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,9 +148,16 @@
|
||||
nav.NavigateTo("/Sign-in/VerificationRegister");
|
||||
else if (VerificationCodeModel.Type == "ForgetPassword")
|
||||
nav.NavigateTo("/Sign-in/VerificationFrogetPass");
|
||||
else if (VerificationCodeModel.Type == "ChangeUserName")
|
||||
{
|
||||
userinfo.UserName = VerificationCodeModel.val;
|
||||
|
||||
nav.NavigateTo("/Profile/Verification");
|
||||
}
|
||||
|
||||
else
|
||||
nav.NavigateTo("/");
|
||||
|
||||
nav.NavigateTo("/");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,7 +167,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert(await request.Content.ReadFromJsonAsync<string>());
|
||||
var listerror = await request.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(listerror[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +191,8 @@
|
||||
{
|
||||
if (!successfull)
|
||||
await _hc.DeleteAsync($"Verification/Remove/{VerificationCodeModel?.ID}");
|
||||
|
||||
if (VerificationCodeModel.Type == "ChangeUserName")
|
||||
nav.NavigateTo("/Profile");
|
||||
nav.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
@@ -17,9 +17,9 @@ builder.Services.AddScoped<HttpClientController>();
|
||||
builder.Services.AddScoped(sp => new UserAuthenticationDTO());
|
||||
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||
|
||||
|
Reference in New Issue
Block a user