File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 3
3
<EditForm Model =" @this" class =" form-horizontal py-5" OnValidSubmit =" @Login" >
4
4
<DataAnnotationsValidator />
5
5
<div class =" mb-3" >
6
- <label for =" username " class =" form-label" >User name </label >
7
- <InputText id =" username " class =" form-control" @bind-Value =" Username " />
8
- <ValidationMessage For =" @(() => Username )" />
6
+ <label for =" email " class =" form-label" >Email </label >
7
+ <InputText id =" email " class =" form-control" @bind-Value =" Email " />
8
+ <ValidationMessage For =" @(() => Email )" />
9
9
</div >
10
10
<div class =" mb-3" >
11
11
<label for =" password" class =" form-label" >Password</label >
34
34
string ? alertMessage ;
35
35
36
36
[Required ]
37
- [StringLength (15 )]
38
- public string ? Username { get ; set ; }
37
+ [StringLength (256 )]
38
+ public string ? Email { get ; set ; }
39
39
40
40
[Required ]
41
41
[StringLength (32 , MinimumLength = 6 , ErrorMessage = " The password must be between 6 and 32 characters long." )]
53
53
async Task Login ()
54
54
{
55
55
alertMessage = null ;
56
- if (await Client .LoginAsync (Username , Password ))
56
+ if (await Client .LoginAsync (Email , Password ))
57
57
{
58
- await OnLoggedIn .InvokeAsync (Username );
58
+ await OnLoggedIn .InvokeAsync (Email );
59
59
}
60
60
else
61
61
{
66
66
async Task Create ()
67
67
{
68
68
alertMessage = null ;
69
- if (await Client .CreateUserAsync (Username , Password ))
69
+ if (await Client .CreateUserAsync (Email , Password ))
70
70
{
71
- await OnLoggedIn .InvokeAsync (Username );
71
+ await OnLoggedIn .InvokeAsync (Email );
72
72
}
73
73
else
74
74
{
Original file line number Diff line number Diff line change @@ -50,25 +50,25 @@ public async Task<bool> DeleteTodoAsync(int id)
50
50
return ( statusCode , todos ) ;
51
51
}
52
52
53
- public async Task < bool > LoginAsync ( string ? username , string ? password )
53
+ public async Task < bool > LoginAsync ( string ? email , string ? password )
54
54
{
55
- if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( password ) )
55
+ if ( string . IsNullOrEmpty ( email ) || string . IsNullOrEmpty ( password ) )
56
56
{
57
57
return false ;
58
58
}
59
59
60
- var response = await client . PostAsJsonAsync ( "auth/login" , new UserInfo { Email = username , Password = password } ) ;
60
+ var response = await client . PostAsJsonAsync ( "auth/login" , new UserInfo { Email = email , Password = password } ) ;
61
61
return response . IsSuccessStatusCode ;
62
62
}
63
63
64
- public async Task < bool > CreateUserAsync ( string ? username , string ? password )
64
+ public async Task < bool > CreateUserAsync ( string ? email , string ? password )
65
65
{
66
- if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( password ) )
66
+ if ( string . IsNullOrEmpty ( email ) || string . IsNullOrEmpty ( password ) )
67
67
{
68
68
return false ;
69
69
}
70
70
71
- var response = await client . PostAsJsonAsync ( "auth/register" , new UserInfo { Email = username , Password = password } ) ;
71
+ var response = await client . PostAsJsonAsync ( "auth/register" , new UserInfo { Email = email , Password = password } ) ;
72
72
return response . IsSuccessStatusCode ;
73
73
}
74
74
You can’t perform that action at this time.
0 commit comments