Skip to content

Commit 7a700ab

Browse files
committed
option to hide username/password fields
1 parent 42aa90f commit 7a700ab

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
sable: minor
3+
---
4+
5+
Added config option `hideUsernamePasswordFields` for hosts to hide username and password fields from login page.

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"elementCallUrl": null,
66

77
"disableAccountSwitcher": false,
8+
"hideUsernamePasswordFields": false,
89

910
"pushNotificationDetails": {
1011
"pushNotifyUrl": "https://cinny.cc/_matrix/push/v1/notify",

src/app/hooks/useClientConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type ClientConfig = {
1212
elementCallUrl?: string;
1313

1414
disableAccountSwitcher?: boolean;
15+
hideUsernamePasswordFields?: boolean;
1516

1617
pushNotificationDetails?: {
1718
pushNotifyUrl?: string;

src/app/pages/auth/login/Login.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const useLoginSearchParams = (searchParams: URLSearchParams): LoginPathSearchPar
3737
export function Login() {
3838
const server = useAuthServer();
3939
const { hashRouter } = useClientConfig();
40+
const { hideUsernamePasswordFields } = useClientConfig();
4041
const { loginFlows } = useAuthFlows();
4142
const [searchParams] = useSearchParams();
4243
const loginSearchParams = useLoginSearchParams(searchParams);
@@ -62,7 +63,7 @@ export function Login() {
6263
{parsedFlows.token && loginSearchParams.loginToken && (
6364
<TokenLogin token={loginSearchParams.loginToken} />
6465
)}
65-
{parsedFlows.password && (
66+
{!hideUsernamePasswordFields && parsedFlows.password && (
6667
<>
6768
<PasswordLoginForm
6869
defaultUsername={loginSearchParams.username}

0 commit comments

Comments
 (0)