Skip to content

Commit a6c27db

Browse files
committed
使用新的密码框组件
1 parent 596c8eb commit a6c27db

File tree

3 files changed

+20
-41
lines changed

3 files changed

+20
-41
lines changed

src/ComputerLock/Components/ResetPassword.razor

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
<MudDialog>
22
<DialogContent>
3-
<MudTextField @bind-Value="_currentPassword"
4-
Label="@(Lang["CurrentPassword"])"
5-
InputType="InputType.Password"
6-
Variant="Variant.Text" />
3+
<MudPaper Width="350px" Elevation="0">
4+
<MudPasswordField @bind-Value="@_currentPassword"
5+
Variant="Variant.Text"
6+
Label="@(Lang["CurrentPassword"])"
7+
IconSize="Size.Small" />
78

8-
<MudTextField @bind-Value="_newPassword"
9-
Label="@(Lang["NewPassword"])"
10-
InputType="InputType.Password"
11-
Variant="Variant.Text" />
9+
<MudPasswordField @bind-Value="@_newPassword"
10+
Class="my-2"
11+
Variant="Variant.Text"
12+
Label="@(Lang["NewPassword"])"
13+
IconSize="Size.Small" />
1214

13-
<MudTextField @bind-Value="_confirmPassword"
14-
Label="@(Lang["ConfirmPassword"])"
15-
InputType="InputType.Password"
16-
Variant="Variant.Text" />
15+
<MudPasswordField @bind-Value="@_confirmPassword"
16+
Variant="Variant.Text"
17+
Label="@(Lang["ConfirmPassword"])"
18+
IconSize="Size.Small" />
19+
</MudPaper>
1720
</DialogContent>
1821
<DialogActions>
1922
<MudButton Color="Color.Primary"

src/ComputerLock/Components/SetPassword.razor

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
<MudTextField @bind-Value="_password"
2-
Class="mt-6"
3-
Label="@(Lang["SetPasswordInput"])"
4-
Variant="Variant.Text"
5-
InputType="@_passwordInputType"
6-
Adornment="Adornment.End"
7-
AdornmentIcon="@_passwordInputIcon"
8-
IconSize="Size.Small"
9-
OnAdornmentClick="ShowPassword" />
1+
<MudPasswordField @bind-Value="@_password"
2+
Class="mt-6"
3+
Variant="Variant.Text"
4+
Label="@(Lang["SetPasswordInput"])"
5+
IconSize="Size.Small" />
106

117
<MudButton Class="mt-4"
128
FullWidth="true"

src/ComputerLock/Components/SetPassword.razor.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ public partial class SetPassword
77
[Inject]
88
private ISnackbar Snackbar { get; set; } = default!;
99

10-
11-
private bool _isShow;
1210
private string _password = "";
13-
private InputType _passwordInputType = InputType.Password;
14-
private string _passwordInputIcon = Icons.Material.Filled.VisibilityOff;
1511

1612
[Parameter]
1713
public EventCallback<string> PasswordSetFinished { get; set; }
@@ -21,22 +17,6 @@ protected override async Task OnInitializedAsync()
2117
await base.OnInitializedAsync();
2218
}
2319

24-
private void ShowPassword()
25-
{
26-
if (_isShow)
27-
{
28-
_isShow = false;
29-
_passwordInputIcon = Icons.Material.Filled.VisibilityOff;
30-
_passwordInputType = InputType.Password;
31-
}
32-
else
33-
{
34-
_isShow = true;
35-
_passwordInputIcon = Icons.Material.Filled.Visibility;
36-
_passwordInputType = InputType.Text;
37-
}
38-
}
39-
4020
private async Task SavePasswordAsync()
4121
{
4222
if (_password.IsEmpty())

0 commit comments

Comments
 (0)