Browse Source

Added validation to login form

BISKI2023-18
parent
commit
37512d3f16
  1. 6
      Client/Biskilog Accounting.Client.csproj
  2. 4
      Client/Pages/Auth/Login.razor
  3. 10
      Client/Properties/launchSettings.json
  4. 2
      Server/Biskilog Accounting.Server.csproj
  5. 40
      Server/Properties/launchSettings.json
  6. 3
      Shared/ClientContractModels/Userauth.cs

6
Client/Biskilog Accounting.Client.csproj

@ -8,6 +8,12 @@
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'https' ">
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'http' ">
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

4
Client/Pages/Auth/Login.razor

@ -81,15 +81,19 @@
<form>
<p>Please login to your account</p>
<Microsoft.AspNetCore.Components.Forms.DataAnnotationsValidator/>
<div class="form-outline mb-4">
<input type="email" id="form2Example11" class="form-control"
placeholder="Phone number or email address" @oninput="@(args => usernameInput(args.Value.ToString()))" @onkeydown="@Enter" />
<label class="form-label" for="form2Example11">Username</label>
<Microsoft.AspNetCore.Components.Forms.ValidationMessage For="@(() => authenticatedUser.Username)"/>
</div>
<div class="form-outline mb-4">
<input type="password" id="form2Example22" class="form-control" @oninput="@(args => passwordInput(args.Value.ToString()))" @onkeydown="@Enter" />
<label class="form-label" for="form2Example22">Password</label>
<Microsoft.AspNetCore.Components.Forms.ValidationMessage For="@(() => authenticatedUser.Passsword)"/>
</div>
<div class="text-center pt-1 mb-5 pb-1">

10
Client/Properties/launchSettings.json

@ -8,23 +8,23 @@
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5136",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7247;http://localhost:5136",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
@ -35,4 +35,4 @@
}
}
}
}
}

2
Server/Biskilog Accounting.Server.csproj

@ -8,6 +8,8 @@
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'https' " />
<PropertyGroup Condition=" '$(RunConfiguration)' == 'http' " />
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.3.0" />

40
Server/Properties/launchSettings.json

@ -1,44 +1,44 @@
{
"iisExpress": {
"applicationUrl": "http://localhost:24369",
"sslPort": 44366
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54487/",
"sslPort": 44383
}
},
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5136",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5136"
"dotnetRunMessages": true
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7247;http://localhost:5136",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7247;http://localhost:5136"
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
},
"iisExpress": {
"applicationUrl": "http://localhost:24369",
"sslPort": 44366
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54487/",
"sslPort": 44383
}
}
}
}

3
Shared/ClientContractModels/Userauth.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Biskilog_Accounting.Shared.ClientContractModels;
@ -9,10 +10,12 @@ public partial class Userauth
public int ClientId { get; set; }
[Required(ErrorMessage = "Invalid username")]
public string? Username { get; set; }
public string? Email { get; set; }
[Required(ErrorMessage = "Invalid password")]
public string? Passsword { get; set; }
public string? PhoneNumber { get; set; }

Loading…
Cancel
Save