File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 "type" : " coreclr" ,
1616 "request" : " launch" ,
1717 "preLaunchTask" : " build" ,
18- "program" : " ${workspaceFolder}/Todo.Web/Server/bin/Debug/net8 .0/Todo.Web.Server.dll" ,
18+ "program" : " ${workspaceFolder}/Todo.Web/Server/bin/Debug/net9 .0/Todo.Web.Server.dll" ,
1919 "args" : [],
2020 "cwd" : " ${workspaceFolder}/Todo.Web/Server" ,
2121 "launchSettingsProfile" : " https" ,
3737 "request" : " launch" ,
3838 "preLaunchTask" : " build" ,
3939 // If you have changed target frameworks, make sure to update the program path.
40- "program" : " ${workspaceFolder}/TodoApi/bin/Debug/net8 .0/TodoApi.dll" ,
40+ "program" : " ${workspaceFolder}/TodoApi/bin/Debug/net9 .0/TodoApi.dll" ,
4141 "args" : [],
4242 "cwd" : " ${workspaceFolder}/TodoApi" ,
4343 "stopAtEntry" : false ,
Original file line number Diff line number Diff line change 33<EditForm Model =" @this" class =" form-horizontal py-5" OnValidSubmit =" @Login" >
44 <DataAnnotationsValidator />
55 <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 )" />
99 </div >
1010 <div class =" mb-3" >
1111 <label for =" password" class =" form-label" >Password</label >
3434 string ? alertMessage ;
3535
3636 [Required ]
37- [StringLength (15 )]
38- public string ? Username { get ; set ; }
37+ [StringLength (256 )]
38+ public string ? Email { get ; set ; }
3939
4040 [Required ]
4141 [StringLength (32 , MinimumLength = 6 , ErrorMessage = " The password must be between 6 and 32 characters long." )]
5353 async Task Login ()
5454 {
5555 alertMessage = null ;
56- if (await Client .LoginAsync (Username , Password ))
56+ if (await Client .LoginAsync (Email , Password ))
5757 {
58- await OnLoggedIn .InvokeAsync (Username );
58+ await OnLoggedIn .InvokeAsync (Email );
5959 }
6060 else
6161 {
6666 async Task Create ()
6767 {
6868 alertMessage = null ;
69- if (await Client .CreateUserAsync (Username , Password ))
69+ if (await Client .CreateUserAsync (Email , Password ))
7070 {
71- await OnLoggedIn .InvokeAsync (Username );
71+ await OnLoggedIn .InvokeAsync (Email );
7272 }
7373 else
7474 {
Original file line number Diff line number Diff line change @@ -50,25 +50,25 @@ public async Task<bool> DeleteTodoAsync(int id)
5050 return ( statusCode , todos ) ;
5151 }
5252
53- public async Task < bool > LoginAsync ( string ? username , string ? password )
53+ public async Task < bool > LoginAsync ( string ? email , string ? password )
5454 {
55- if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( password ) )
55+ if ( string . IsNullOrEmpty ( email ) || string . IsNullOrEmpty ( password ) )
5656 {
5757 return false ;
5858 }
5959
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 } ) ;
6161 return response . IsSuccessStatusCode ;
6262 }
6363
64- public async Task < bool > CreateUserAsync ( string ? username , string ? password )
64+ public async Task < bool > CreateUserAsync ( string ? email , string ? password )
6565 {
66- if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( password ) )
66+ if ( string . IsNullOrEmpty ( email ) || string . IsNullOrEmpty ( password ) )
6767 {
6868 return false ;
6969 }
7070
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 } ) ;
7272 return response . IsSuccessStatusCode ;
7373 }
7474
Original file line number Diff line number Diff line change 4040}
4141
4242app . UseHttpsRedirection ( ) ;
43- app . UseStaticFiles ( ) ;
4443app . UseAntiforgery ( ) ;
4544
45+ app . MapStaticAssets ( ) ;
4646app . MapRazorComponents < App > ( )
4747 . AddInteractiveWebAssemblyRenderMode ( ) ;
4848
You can’t perform that action at this time.
0 commit comments