mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-03-19 15:18:02 -04:00
Add public registration enabled check to client (#343)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
@page "/user/login"
|
||||
@inherits AliasVault.Client.Auth.Pages.Base.LoginBase
|
||||
@layout Auth.Layout.MainLayout
|
||||
@inject Config Config
|
||||
@attribute [AllowAnonymous]
|
||||
@using System.Text.Json
|
||||
@using AliasVault.Shared.Models.WebApi.Auth
|
||||
@@ -103,9 +104,12 @@ else
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full px-5 py-3 text-base font-medium text-center text-white bg-primary-700 rounded-lg hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">Login to your account</button>
|
||||
<div class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
||||
No account yet? <a href="/user/setup" class="text-primary-700 hover:underline dark:text-primary-500">Create new vault</a>
|
||||
</div>
|
||||
@if (Config.PublicRegistrationEnabled)
|
||||
{
|
||||
<div class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
||||
No account yet? <a href="/user/setup" class="text-primary-700 hover:underline dark:text-primary-500">Create new vault</a>
|
||||
</div>
|
||||
}
|
||||
</EditForm>
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@using AliasVault.Client.Auth.Components
|
||||
@inherits AliasVault.Client.Auth.Pages.Base.LoginBase
|
||||
@layout Auth.Layout.EmptyLayout
|
||||
@inject Config Config
|
||||
@attribute [AllowAnonymous]
|
||||
|
||||
<div class="flex lg:min-h-screen bg-gray-50 dark:bg-gray-900">
|
||||
@@ -22,9 +23,12 @@
|
||||
Your Privacy. Protected.
|
||||
</p>
|
||||
<div class="space-y-4">
|
||||
<a href="/user/setup" class="block w-full py-3 px-4 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition duration-300 ease-in-out text-center">
|
||||
Create new vault
|
||||
</a>
|
||||
@if (Config.PublicRegistrationEnabled)
|
||||
{
|
||||
<a href="/user/setup" class="block w-full py-3 px-4 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition duration-300 ease-in-out text-center">
|
||||
Create new vault
|
||||
</a>
|
||||
}
|
||||
<a href="/user/login" class="block w-full py-3 px-4 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-800 text-gray-800 dark:text-white font-semibold rounded-lg transition duration-300 ease-in-out text-center">
|
||||
Log in with existing account
|
||||
</a>
|
||||
|
||||
@@ -62,4 +62,9 @@ public class Config
|
||||
/// Gets or sets the support email address that users can contact for password recovery.
|
||||
/// </summary>
|
||||
public string? SupportEmail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether public registration is enabled.
|
||||
/// </summary>
|
||||
public bool PublicRegistrationEnabled { get; set; }
|
||||
}
|
||||
|
||||
@@ -41,5 +41,8 @@ else
|
||||
sed -i "s|\"SupportEmail\": \".*\"|\"SupportEmail\": \"\"|g" /usr/share/nginx/html/appsettings.json
|
||||
fi
|
||||
|
||||
# Update public registration enabled in appsettings.json
|
||||
sed -i "s|\"PublicRegistrationEnabled\": \".*\"|\"PublicRegistrationEnabled\": \"$PUBLIC_REGISTRATION_ENABLED\"|g" /usr/share/nginx/html/appsettings.json
|
||||
|
||||
# Start the application
|
||||
nginx -g "daemon off;"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"ApiUrl": "http://localhost:5092",
|
||||
"PrivateEmailDomains": ["example.tld"],
|
||||
"SupportEmail": "support@example.tld"
|
||||
"SupportEmail": "support@example.tld",
|
||||
"PublicRegistrationEnabled": "true"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user