diff --git a/.vscode/launch.json b/.vscode/launch.json index 26bc2e7..28816c6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,50 +1,9 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": ".NET Core Launch (web)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/AzureWebStorageExplorer/bin/Debug/net8.0/AzureWebStorageExplorer.dll", - "args": [], - "cwd": "${workspaceFolder}/src/AzureWebStorageExplorer", - "stopAtEntry": false, - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)" - }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development", - "MOCK": "true" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - } - }, - { - "name": "BlazorWASM", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - "program": "${workspaceFolder}/src/wasm/bin/Debug/net8.0/wasm.dll", - "args": [], - "cwd": "${workspaceFolder}/src/wasm", - "stopAtEntry": false, - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)" - }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - } - }, + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ { "name": "Blazor WEB", "type": "coreclr", @@ -89,10 +48,10 @@ "/Views": "${workspaceFolder}/Views" } }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach" - } - ] + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] } \ No newline at end of file diff --git a/src/web/Directory.Build.props b/src/web/Directory.Build.props index 39bc7cc..b63e799 100644 --- a/src/web/Directory.Build.props +++ b/src/web/Directory.Build.props @@ -1,5 +1,5 @@ - 2.16.4 + 2.17.0 \ No newline at end of file diff --git a/src/web/Pages/Login.razor b/src/web/Pages/Login.razor index 4c4eac3..e43d1ae 100644 --- a/src/web/Pages/Login.razor +++ b/src/web/Pages/Login.razor @@ -11,8 +11,8 @@
Sign in
Sign in with your Azure Key or Shared Access Signature
-
- +
+

@@ -26,7 +26,7 @@
@*

*@ - @*
*@ + @*
*@

Or

@*

*@ @@ -44,7 +44,7 @@ @if (ShowError) { -
Invalid account or key
+
@AccountErrorMessage
}
diff --git a/src/web/Pages/Login.razor.cs b/src/web/Pages/Login.razor.cs index 231b370..ba349d6 100644 --- a/src/web/Pages/Login.razor.cs +++ b/src/web/Pages/Login.razor.cs @@ -1,7 +1,7 @@ +using System.Text.RegularExpressions; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; using Microsoft.AspNetCore.Components.Web; -using StorageLibrary; using web.Utils; namespace web.Pages @@ -12,6 +12,8 @@ public partial class Login public bool ShowError { get; set; } public string? ErrorMessage { get; set; } public string? AzureAccount { get; set; } = ""; + public string? AccountErrorMessage { get; set; } = ""; + public string? AccountClass { get; set; } = ""; public string? AzureKey { get; set; } = ""; public string AzureUrl { get; set; } = "core.windows.net"; public string? ConnectionString { get; set; } @@ -30,6 +32,23 @@ private void NavigateOnEnter(KeyboardEventArgs args) } } + private void ValidateAccount(FocusEventArgs args) + { + string validpattern = "^[a-z0-9]{3,24}$"; + if (!Regex.IsMatch(AzureAccount!, validpattern)) + { + ShowError = true; + AccountErrorMessage = $"Account is not a valid name"; + AccountClass = "error"; + } + else + { + ShowError = false; + AccountErrorMessage = string.Empty; + AccountClass = ""; + } + } + protected override async Task OnInitializedAsync() { string? connString = Environment.GetEnvironmentVariable(Util.AZURE_STORAGE_CONNECTIONSTRING); @@ -84,6 +103,7 @@ private async Task SignIn() catch (Exception ex) { ShowError = true; + AccountErrorMessage = "Invalid account or account key"; ErrorMessage = ex.Message; } } diff --git a/src/web/Shared/Version.razor b/src/web/Shared/Version.razor index ffa30ac..65b11a8 100644 --- a/src/web/Shared/Version.razor +++ b/src/web/Shared/Version.razor @@ -3,7 +3,7 @@
v @CurrentVersion by @@sebagomez -
Made with πŸ§‰ in πŸ‡ΊπŸ‡Ύ and πŸ‡¨πŸ‡¦
+
Made with πŸ§‰ in and
@code {