Added verification on clock side
This commit is contained in:
parent
1df4d64edf
commit
7b96ee5670
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.vs/QUR/v17/.suo
BIN
.vs/QUR/v17/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -197,13 +197,13 @@
|
|||
"mscorlib.dll": "sha256-ZQiPq7CHB7vwsbgiGeI63xqAYmfnZVwKnCDxwIIfh68=",
|
||||
"netstandard.dll": "sha256-OUZMjYvE6WNC75Ypitp3ukl0+FlDbSW+OYEIsU7XlgQ=",
|
||||
"System.Private.CoreLib.dll": "sha256-uJANsJB4HA9iyaKf1ryCSbtypfL2uQZWxXKIn0Fz5+c=",
|
||||
"Authenticator.dll": "sha256-HgkF587ivkii1JAKZ9pD9iOZp6dsn6mwt69pbBUTJ30="
|
||||
"Authenticator.dll": "sha256-r7d0fWLyghwoyih4qcgDuY2yPsJ93fG5Znu0xOH5Ots="
|
||||
},
|
||||
"extensions": null,
|
||||
"lazyAssembly": null,
|
||||
"libraryInitializers": null,
|
||||
"pdb": {
|
||||
"Authenticator.pdb": "sha256-wgmktoDHI6KOueaOLMLQI95N\/xumyttT+2m7mdXd850="
|
||||
"Authenticator.pdb": "sha256-SyZNML1LrKYUybm5xbJr8VSZX4vZNT\/BBDcn1ZtpK48="
|
||||
},
|
||||
"runtime": {
|
||||
"dotnet.6.0.21.49na9txwsb.js": "sha256-0OV6gibFzyVtG7NXEj8a6vG3u8Cbzv4l9kkEathZjQ8=",
|
||||
|
|
|
@ -809,11 +809,11 @@
|
|||
"url": "_framework\/icudt_no_CJK.dat"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-ak6RoVMgOBqvz0fAQLAx1APkPNvkqx+s5WX5gYzFEiU=",
|
||||
"hash": "sha256-fSm+brDZanxOA0JtaFRuHbJwri2Ct7X+vDM0+WZfPHM=",
|
||||
"url": "_framework\/Authenticator.dll"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-qeEVLk4Mnyv6IJb1ByRTdXCS+OoB2UlL21FmI2crZHw=",
|
||||
"hash": "sha256-rrIGrQkkt34ho2yyUQpNMTFwupeFsguY5qPQUvup7ss=",
|
||||
"url": "_framework\/Authenticator.pdb"
|
||||
},
|
||||
{
|
||||
|
@ -821,7 +821,7 @@
|
|||
"url": "_framework\/blazor.webassembly.js"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-PP9AvSeOqUdkPgqUNK46HU83+SDyYDUgUvx0Ya+9ARU=",
|
||||
"hash": "sha256-glR48yxTOF8iHHdkVHv6IyJknpkmaCLS4I553TdLZ+Y=",
|
||||
"url": "_framework\/blazor.boot.json"
|
||||
},
|
||||
{
|
||||
|
@ -833,5 +833,5 @@
|
|||
"url": "_content\/MudBlazor\/MudBlazor.min.js"
|
||||
}
|
||||
],
|
||||
"version": "ijzYJC8z"
|
||||
"version": "tu9JW7d9"
|
||||
};
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
// This is because caching would make development more difficult (changes would not
|
||||
// be reflected on the first load after each change).
|
||||
self.addEventListener('fetch', () => { });
|
||||
/* Manifest version: ijzYJC8z */
|
||||
/* Manifest version: tu9JW7d9 */
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -197,13 +197,13 @@
|
|||
"mscorlib.dll": "sha256-ZQiPq7CHB7vwsbgiGeI63xqAYmfnZVwKnCDxwIIfh68=",
|
||||
"netstandard.dll": "sha256-OUZMjYvE6WNC75Ypitp3ukl0+FlDbSW+OYEIsU7XlgQ=",
|
||||
"System.Private.CoreLib.dll": "sha256-uJANsJB4HA9iyaKf1ryCSbtypfL2uQZWxXKIn0Fz5+c=",
|
||||
"Authenticator.dll": "sha256-HgkF587ivkii1JAKZ9pD9iOZp6dsn6mwt69pbBUTJ30="
|
||||
"Authenticator.dll": "sha256-r7d0fWLyghwoyih4qcgDuY2yPsJ93fG5Znu0xOH5Ots="
|
||||
},
|
||||
"extensions": null,
|
||||
"lazyAssembly": null,
|
||||
"libraryInitializers": null,
|
||||
"pdb": {
|
||||
"Authenticator.pdb": "sha256-wgmktoDHI6KOueaOLMLQI95N\/xumyttT+2m7mdXd850="
|
||||
"Authenticator.pdb": "sha256-SyZNML1LrKYUybm5xbJr8VSZX4vZNT\/BBDcn1ZtpK48="
|
||||
},
|
||||
"runtime": {
|
||||
"dotnet.6.0.21.49na9txwsb.js": "sha256-0OV6gibFzyVtG7NXEj8a6vG3u8Cbzv4l9kkEathZjQ8=",
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -809,11 +809,11 @@
|
|||
"url": "_framework\/icudt_no_CJK.dat"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-ak6RoVMgOBqvz0fAQLAx1APkPNvkqx+s5WX5gYzFEiU=",
|
||||
"hash": "sha256-fSm+brDZanxOA0JtaFRuHbJwri2Ct7X+vDM0+WZfPHM=",
|
||||
"url": "_framework\/Authenticator.dll"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-qeEVLk4Mnyv6IJb1ByRTdXCS+OoB2UlL21FmI2crZHw=",
|
||||
"hash": "sha256-rrIGrQkkt34ho2yyUQpNMTFwupeFsguY5qPQUvup7ss=",
|
||||
"url": "_framework\/Authenticator.pdb"
|
||||
},
|
||||
{
|
||||
|
@ -821,7 +821,7 @@
|
|||
"url": "_framework\/blazor.webassembly.js"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-PP9AvSeOqUdkPgqUNK46HU83+SDyYDUgUvx0Ya+9ARU=",
|
||||
"hash": "sha256-glR48yxTOF8iHHdkVHv6IyJknpkmaCLS4I553TdLZ+Y=",
|
||||
"url": "_framework\/blazor.boot.json"
|
||||
},
|
||||
{
|
||||
|
@ -833,5 +833,5 @@
|
|||
"url": "_content\/MudBlazor\/MudBlazor.min.js"
|
||||
}
|
||||
],
|
||||
"version": "ijzYJC8z"
|
||||
"version": "tu9JW7d9"
|
||||
};
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
// This is because caching would make development more difficult (changes would not
|
||||
// be reflected on the first load after each change).
|
||||
self.addEventListener('fetch', () => { });
|
||||
/* Manifest version: ijzYJC8z */
|
||||
/* Manifest version: tu9JW7d9 */
|
||||
|
|
|
@ -1,7 +1,68 @@
|
|||
@page "/"
|
||||
@using System.Text;
|
||||
@inject ISnackbar snackbar
|
||||
@inject NavigationManager navigator
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
<PageTitle>Authentication</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3" GutterBottom="true">Hello, world!</MudText>
|
||||
<MudText Class="mb-8">Welcome to your new app, powered by MudBlazor!</MudText>
|
||||
<MudAlert Severity="Severity.Normal">You can find documentation and examples on our website here: <MudLink Href="https://mudblazor.com" Typo="Typo.body2" Color="Color.Inherit"><b>www.mudblazor.com</b></MudLink></MudAlert>
|
||||
<MudForm @ref="form" @bind-IsValid="@success">
|
||||
<MudTextField @ref="pwField1" T="string" Label="AuthCode" Required="true" Validation="@(new Func<string, string>(PasswordMatch))" RequiredError="AuthCode is required!" />
|
||||
</MudForm>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" DisableElevation="true" OnClick="Validate">Validate</MudButton>
|
||||
|
||||
@code {
|
||||
string authCode = "";
|
||||
bool success = false;
|
||||
MudForm form;
|
||||
MudTextField<string> pwField1;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
GetCode();
|
||||
}
|
||||
|
||||
private string PasswordMatch(string input)
|
||||
{
|
||||
if (pwField1.Value != authCode)
|
||||
return "AuthCode not correct";
|
||||
return null;
|
||||
}
|
||||
|
||||
async void Validate()
|
||||
{
|
||||
await form.Validate();
|
||||
|
||||
if (!success) return;
|
||||
|
||||
snackbar.Add("Success!", Severity.Success);
|
||||
|
||||
await Task.Delay(3000);
|
||||
|
||||
navigator.NavigateTo("/Clock");
|
||||
}
|
||||
|
||||
public string GetCode()
|
||||
{
|
||||
var time = DateTime.Now;
|
||||
Random random = new Random(time.Hour);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
string salt = (i + random.NextDouble()).ToString();
|
||||
sb.AppendLine(salt);
|
||||
}
|
||||
|
||||
string semicode = Base64Encode(time.ToString("HH") + sb.ToString());
|
||||
semicode = semicode.Trim('=');
|
||||
authCode = semicode;
|
||||
|
||||
return semicode;
|
||||
}
|
||||
|
||||
public static string Base64Encode(string plainText)
|
||||
{
|
||||
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
|
||||
return System.Convert.ToBase64String(plainTextBytes);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,6 @@
|
|||
"Mudblazor.Template": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "https://localhost:5001/Clock",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -198,13 +198,13 @@
|
|||
"mscorlib.dll": "sha256-ZQiPq7CHB7vwsbgiGeI63xqAYmfnZVwKnCDxwIIfh68=",
|
||||
"netstandard.dll": "sha256-OUZMjYvE6WNC75Ypitp3ukl0+FlDbSW+OYEIsU7XlgQ=",
|
||||
"System.Private.CoreLib.dll": "sha256-uJANsJB4HA9iyaKf1ryCSbtypfL2uQZWxXKIn0Fz5+c=",
|
||||
"QUR.dll": "sha256-OXP\/zeV+upwRfebG2yvwMnp2Njra4XMTBAyKHTORrLc="
|
||||
"QUR.dll": "sha256-Pxn8L5fbl1gI1Sv3Ory3wza5wGV5yUZpatB+zbnp+Kw="
|
||||
},
|
||||
"extensions": null,
|
||||
"lazyAssembly": null,
|
||||
"libraryInitializers": null,
|
||||
"pdb": {
|
||||
"QUR.pdb": "sha256-+tmyLU4mNCUc+no40A9fxbLM30vvQk8vw4Ka9\/eHzLA="
|
||||
"QUR.pdb": "sha256-ee391gtX3eUWYcfZbUoxBdGcG2XXwW5baylxg+bpyJo="
|
||||
},
|
||||
"runtime": {
|
||||
"dotnet.6.0.21.49na9txwsb.js": "sha256-0OV6gibFzyVtG7NXEj8a6vG3u8Cbzv4l9kkEathZjQ8=",
|
||||
|
|
|
@ -821,11 +821,11 @@
|
|||
"url": "_framework\/icudt_no_CJK.dat"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-N1KCccGRMSBt+zFb9r\/hFit82badxEDZFxCUlxqYEIE=",
|
||||
"hash": "sha256-dsR1lC7g1W6ritKpOzSk0rNRIuJi73RcH7sCTeABYsw=",
|
||||
"url": "_framework\/QUR.dll"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-ljSNxu9TlSxBfT5p\/FQNXPIYBCTFaTOVZfpn+mAOFCE=",
|
||||
"hash": "sha256-ISHg\/r6FCT0B0PRzJK2x0PhJ38nXaN1pMqohuH1U3D4=",
|
||||
"url": "_framework\/QUR.pdb"
|
||||
},
|
||||
{
|
||||
|
@ -833,7 +833,7 @@
|
|||
"url": "_framework\/blazor.webassembly.js"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-PnnvCJhZU9H2EKY6XrVg0ZvtJcc1AZAHAN8eJR9qRRQ=",
|
||||
"hash": "sha256-K4GlZljUX9wp9ZBuh5cX\/JhP\/1+5NXmEgjK97FFFv0s=",
|
||||
"url": "_framework\/blazor.boot.json"
|
||||
},
|
||||
{
|
||||
|
@ -845,5 +845,5 @@
|
|||
"url": "_content\/MudBlazor\/MudBlazor.min.js"
|
||||
}
|
||||
],
|
||||
"version": "tpm+quQ4"
|
||||
"version": "yFzJ54jy"
|
||||
};
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
// This is because caching would make development more difficult (changes would not
|
||||
// be reflected on the first load after each change).
|
||||
self.addEventListener('fetch', () => { });
|
||||
/* Manifest version: tpm+quQ4 */
|
||||
/* Manifest version: yFzJ54jy */
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -198,13 +198,13 @@
|
|||
"mscorlib.dll": "sha256-ZQiPq7CHB7vwsbgiGeI63xqAYmfnZVwKnCDxwIIfh68=",
|
||||
"netstandard.dll": "sha256-OUZMjYvE6WNC75Ypitp3ukl0+FlDbSW+OYEIsU7XlgQ=",
|
||||
"System.Private.CoreLib.dll": "sha256-uJANsJB4HA9iyaKf1ryCSbtypfL2uQZWxXKIn0Fz5+c=",
|
||||
"QUR.dll": "sha256-OXP\/zeV+upwRfebG2yvwMnp2Njra4XMTBAyKHTORrLc="
|
||||
"QUR.dll": "sha256-Pxn8L5fbl1gI1Sv3Ory3wza5wGV5yUZpatB+zbnp+Kw="
|
||||
},
|
||||
"extensions": null,
|
||||
"lazyAssembly": null,
|
||||
"libraryInitializers": null,
|
||||
"pdb": {
|
||||
"QUR.pdb": "sha256-+tmyLU4mNCUc+no40A9fxbLM30vvQk8vw4Ka9\/eHzLA="
|
||||
"QUR.pdb": "sha256-ee391gtX3eUWYcfZbUoxBdGcG2XXwW5baylxg+bpyJo="
|
||||
},
|
||||
"runtime": {
|
||||
"dotnet.6.0.21.49na9txwsb.js": "sha256-0OV6gibFzyVtG7NXEj8a6vG3u8Cbzv4l9kkEathZjQ8=",
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -821,11 +821,11 @@
|
|||
"url": "_framework\/icudt_no_CJK.dat"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-N1KCccGRMSBt+zFb9r\/hFit82badxEDZFxCUlxqYEIE=",
|
||||
"hash": "sha256-dsR1lC7g1W6ritKpOzSk0rNRIuJi73RcH7sCTeABYsw=",
|
||||
"url": "_framework\/QUR.dll"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-ljSNxu9TlSxBfT5p\/FQNXPIYBCTFaTOVZfpn+mAOFCE=",
|
||||
"hash": "sha256-ISHg\/r6FCT0B0PRzJK2x0PhJ38nXaN1pMqohuH1U3D4=",
|
||||
"url": "_framework\/QUR.pdb"
|
||||
},
|
||||
{
|
||||
|
@ -833,7 +833,7 @@
|
|||
"url": "_framework\/blazor.webassembly.js"
|
||||
},
|
||||
{
|
||||
"hash": "sha256-PnnvCJhZU9H2EKY6XrVg0ZvtJcc1AZAHAN8eJR9qRRQ=",
|
||||
"hash": "sha256-K4GlZljUX9wp9ZBuh5cX\/JhP\/1+5NXmEgjK97FFFv0s=",
|
||||
"url": "_framework\/blazor.boot.json"
|
||||
},
|
||||
{
|
||||
|
@ -845,5 +845,5 @@
|
|||
"url": "_content\/MudBlazor\/MudBlazor.min.js"
|
||||
}
|
||||
],
|
||||
"version": "tpm+quQ4"
|
||||
"version": "yFzJ54jy"
|
||||
};
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
// This is because caching would make development more difficult (changes would not
|
||||
// be reflected on the first load after each change).
|
||||
self.addEventListener('fetch', () => { });
|
||||
/* Manifest version: tpm+quQ4 */
|
||||
/* Manifest version: yFzJ54jy */
|
||||
|
|
Loading…
Reference in New Issue