feat(auth): registration mode on ConnectPage (PUBLIC_ENABLE_REGISTRATION)
Add a login/register toggle to ConnectPage backed by a new useRegisterMutation (register -> /auth/me, mirroring login). The toggle is shown only when REGISTRATION_ENABLED, resolved with the same precedence as the API base URL: runtime window.__APP_CONFIG__ > PUBLIC_ENABLE_REGISTRATION env > default true. The prod runtime-config script injects the runtime flag. The backend's ALLOW_REGISTRATION stays the real authority; this only gates the UI. EN/RU strings added. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+17
-2
@@ -31,16 +31,29 @@ const en = {
|
||||
forgetTitle: 'Forget this instance',
|
||||
form: {
|
||||
title: 'Connect to a backend',
|
||||
registerTitle: 'Create an account',
|
||||
serverUrl: 'Server URL',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
passwordHint: 'At least 8 characters.',
|
||||
submit: 'Connect',
|
||||
submitting: 'Connecting…',
|
||||
registerSubmit: 'Create account',
|
||||
registering: 'Creating account…',
|
||||
noAccount: "Don't have an account?",
|
||||
registerLink: 'Sign up',
|
||||
haveAccount: 'Already have an account?',
|
||||
signInLink: 'Sign in',
|
||||
},
|
||||
errors: {
|
||||
unreachable: "Can't reach this server. Check the URL and that it's online.",
|
||||
unreachable:
|
||||
"Can't reach this server. Check the URL and that it's online.",
|
||||
badCredentials: 'Incorrect username or password.',
|
||||
generic: 'Sign-in failed. Please try again.',
|
||||
usernameTaken: 'That username is already taken.',
|
||||
passwordTooShort: 'Password must be at least 8 characters.',
|
||||
registrationDisabled: 'Registration is disabled on this server.',
|
||||
registerFailed: 'Could not create the account. Please try again.',
|
||||
},
|
||||
},
|
||||
library: {
|
||||
@@ -211,6 +224,8 @@ const en = {
|
||||
export default en;
|
||||
|
||||
type DeepString<T> = {
|
||||
[K in keyof T]: T[K] extends Record<string, unknown> ? DeepString<T[K]> : string;
|
||||
[K in keyof T]: T[K] extends Record<string, unknown>
|
||||
? DeepString<T[K]>
|
||||
: string;
|
||||
};
|
||||
export type Translations = DeepString<typeof en>;
|
||||
|
||||
@@ -33,17 +33,29 @@ const ru: Translations = {
|
||||
forgetTitle: 'Забыть этот сервер',
|
||||
form: {
|
||||
title: 'Подключиться к серверу',
|
||||
registerTitle: 'Создать аккаунт',
|
||||
serverUrl: 'URL сервера',
|
||||
username: 'Имя пользователя',
|
||||
password: 'Пароль',
|
||||
passwordHint: 'Не менее 8 символов.',
|
||||
submit: 'Подключиться',
|
||||
submitting: 'Подключение…',
|
||||
registerSubmit: 'Создать аккаунт',
|
||||
registering: 'Создание аккаунта…',
|
||||
noAccount: 'Нет аккаунта?',
|
||||
registerLink: 'Зарегистрироваться',
|
||||
haveAccount: 'Уже есть аккаунт?',
|
||||
signInLink: 'Войти',
|
||||
},
|
||||
errors: {
|
||||
unreachable:
|
||||
'Не удаётся подключиться к серверу. Проверьте URL и доступность.',
|
||||
badCredentials: 'Неверное имя пользователя или пароль.',
|
||||
generic: 'Не удалось войти. Попробуйте ещё раз.',
|
||||
usernameTaken: 'Это имя пользователя уже занято.',
|
||||
passwordTooShort: 'Пароль должен содержать не менее 8 символов.',
|
||||
registrationDisabled: 'Регистрация на этом сервере отключена.',
|
||||
registerFailed: 'Не удалось создать аккаунт. Попробуйте ещё раз.',
|
||||
},
|
||||
},
|
||||
library: {
|
||||
|
||||
Reference in New Issue
Block a user