diff --git a/config.json b/config.json index ed1bca6b..772b61c3 100644 --- a/config.json +++ b/config.json @@ -24,5 +24,10 @@ "dings": { "enabled": false + }, + + "registration": { + "enabled": false, + "url": "" } } diff --git a/src/app/hooks/useClientConfig.ts b/src/app/hooks/useClientConfig.ts index cc293eb1..adc4a64b 100644 --- a/src/app/hooks/useClientConfig.ts +++ b/src/app/hooks/useClientConfig.ts @@ -50,7 +50,7 @@ export function useClientConfig(): ClientConfig { } export const clientDefaultServer = (clientConfig: ClientConfig): string => - clientConfig.homeserverList?.[clientConfig.defaultHomeserver ?? 0] ?? 'gamecult.org'; + clientConfig.homeserverList?.[clientConfig.defaultHomeserver ?? 0] ?? 'matrix.org'; export const clientAllowedServer = (clientConfig: ClientConfig, server: string): boolean => { const { homeserverList, allowCustomHomeservers } = clientConfig; diff --git a/src/app/pages/auth/authMessages.ts b/src/app/pages/auth/authMessages.ts index 3cc858fe..4d9575a5 100644 --- a/src/app/pages/auth/authMessages.ts +++ b/src/app/pages/auth/authMessages.ts @@ -57,7 +57,14 @@ export const serverTroubleMessage = ( export const noSignInMethodMessage = (server: string): string => `${server} does not offer a way to sign in that this app can use. Pick another server from the Homeserver list, or tell whoever runs ${server}.`; -export type RegisterTrouble = 'closed' | 'rate-limited' | 'invalid' | 'unsupported'; +export type RegisterTrouble = + | 'closed' + | 'rate-limited' + | 'invalid' + | 'unsupported' + | 'password-weak' + | 'password-short' + | 'unknown'; export const registerTroubleMessage = (trouble: RegisterTrouble, server: string): string => { switch (trouble) { @@ -67,6 +74,12 @@ export const registerTroubleMessage = (trouble: RegisterTrouble, server: string) return 'Too many tries in a short time. Wait a minute, then try again.'; case 'invalid': return `${server} did not accept the request to make an account. Reload the page and try again; if it keeps failing, tell whoever invited you.`; + case 'password-weak': + return 'That password is too easy to guess. Pick a longer one, with more than one kind of character.'; + case 'password-short': + return 'That password is too short. Pick a longer one.'; + case 'unknown': + return `Something went wrong making the account on ${server}. Try again in a minute; if it keeps failing, tell whoever invited you.`; case 'unsupported': default: return `${server} asks for something this app cannot do when making an account. Tell whoever invited you.`; diff --git a/src/app/pages/auth/authRoutes.tsx b/src/app/pages/auth/authRoutes.tsx index c6fcd2c1..c5ad101f 100644 --- a/src/app/pages/auth/authRoutes.tsx +++ b/src/app/pages/auth/authRoutes.tsx @@ -6,7 +6,7 @@ import { LOGIN_PATH, REGISTER_PATH, RESET_PASSWORD_PATH, SIGNED_UP_PATH } from ' import { getHomePath } from '../pathUtils'; import { AuthLayout } from './AuthLayout'; import { Login } from './login'; -import { Register } from './register'; +import { RegisterRoute } from './register/RegisterRoute'; import { ResetPassword } from './reset-password'; import { SignedUp } from './SignedUp'; @@ -24,7 +24,7 @@ export const authRoutes = () => ( } > } /> - } /> + } /> } /> createClient({ baseUrl }), [baseUrl]); @@ -207,6 +216,9 @@ export function PasswordRegisterForm({ const registerError = registerState.status === AsyncStatus.Error ? registerState.error : undefined; + // The password troubles show under the password field; the rest is the form's. + const registerTrouble = registerError && registerErrorTrouble(registerError.errcode); + const formTrouble = registerTrouble?.startsWith('password-') ? undefined : registerTrouble; useRegisterComplete(customRegisterResp); const handleSubmit: ChangeEventHandler = (evt) => { @@ -298,20 +310,10 @@ export function PasswordRegisterForm({ required /> {registerError?.errcode === RegisterError.PasswordWeak && ( - + )} {registerError?.errcode === RegisterError.PasswordShort && ( - + )} @@ -378,18 +380,7 @@ export function PasswordRegisterForm({ )} - {registerError?.errcode === RegisterError.RateLimited && ( - - )} - {registerError?.errcode === RegisterError.Forbidden && ( - - )} - {registerError?.errcode === RegisterError.InvalidRequest && ( - - )} - {registerError?.errcode === RegisterError.Unknown && ( - - )} + {formTrouble && } setTrainingAck((ack) => !ack)} />