fix: show account registration only when the server advertises the cap
This commit is contained in:
parent
07fe1c940c
commit
85251c537d
1 changed files with 6 additions and 2 deletions
|
|
@ -547,6 +547,7 @@ function LoginTab() {
|
|||
const client = useActiveChat((s) => s.client);
|
||||
const account = useActiveChat((s) => s.account);
|
||||
const nick = useActiveChat((s) => s.nick);
|
||||
const status = useActiveChat((s) => s.status); // re-render once (re)registration acks the caps
|
||||
const [mode, setMode] = useState<'login' | 'register'>('login');
|
||||
const [acct, setAcct] = useState(nick);
|
||||
const [pw, setPw] = useState('');
|
||||
|
|
@ -609,8 +610,11 @@ function LoginTab() {
|
|||
);
|
||||
}
|
||||
|
||||
// Not logged in → login / register switcher (register hidden if disabled in config).
|
||||
const canRegister = getConfig().features.register;
|
||||
// Not logged in → login / register switcher. Registration needs BOTH the build
|
||||
// to enable it AND the server to advertise draft/account-registration; otherwise
|
||||
// REGISTER would just come back as an unknown command (e.g. a leaner ircd).
|
||||
const canRegister = getConfig().features.register
|
||||
&& status === 'registered' && !!client?.hasCap('draft/account-registration');
|
||||
return (
|
||||
<>
|
||||
{canRegister && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue