Skip to content

Commit 5d6b436

Browse files
committed
feat: option to disable form-based login
1 parent 198d080 commit 5d6b436

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

.example.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ DISALLOW_REGISTRATION=true
5858
# Optional - Disable anonymous link creation. Default is true.
5959
DISALLOW_ANONYMOUS_LINKS=true
6060

61+
6162
# Optional - This would be shown to the user on the settings page
6263
# It's only for display purposes and has no other use
6364
SERVER_IP_ADDRESS=
@@ -96,3 +97,6 @@ OIDC_CLIENT_SECRET=
9697
OIDC_SCOPE=
9798
OIDC_EMAIL_CLAIM=
9899
OIDC_APP_URL=
100+
101+
# Optional - Disable form-based login. Only makes sense when OIDC_ENABLED=true.
102+
DISALLOW_FORM_LOGIN=false

server/env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const spec = {
5050
REDIS_DB: num({ default: 0 }),
5151
DISALLOW_ANONYMOUS_LINKS: bool({ default: true }),
5252
DISALLOW_REGISTRATION: bool({ default: true }),
53+
DISALLOW_FORM_LOGIN: bool({ default: false }),
5354
SERVER_IP_ADDRESS: str({ default: "" }),
5455
SERVER_CNAME_ADDRESS: str({ default: "" }),
5556
CUSTOM_DOMAIN_USE_HTTPS: bool({ default: false }),

server/handlers/locals.handler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function config(req, res, next) {
2727
res.locals.server_ip_address = env.SERVER_IP_ADDRESS;
2828
res.locals.server_cname_address = env.SERVER_CNAME_ADDRESS;
2929
res.locals.disallow_registration = env.DISALLOW_REGISTRATION;
30+
res.locals.disallow_form_login = env.DISALLOW_FORM_LOGIN;
3031
res.locals.oidc_enabled = env.OIDC_ENABLED;
3132
res.locals.mail_enabled = env.MAIL_ENABLED;
3233
res.locals.report_email = env.REPORT_EMAIL;

server/views/partials/auth/form.hbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<form id="login-signup" hx-post="/api/auth/login" hx-swap="outerHTML">
2+
{{#unless disallow_form_login}}
23
<label class="{{#if errors.email}}error{{/if}}">
34
Email address:
45
<input
@@ -52,14 +53,17 @@
5253
{{/if}}
5354
{{/unless}}
5455
</div>
56+
{{/unless}}
5557
{{#if oidc_enabled}}
5658
<div class="buttons-wrapper">
5759
<a class="button secondary full" href="/login/oidc" title="Login with OIDC">Login with OIDC</a>
5860
</div>
5961
{{/if}}
62+
{{#unless disallow_form_login}}
6063
{{#if mail_enabled}}
6164
<a class="forgot-password" href="/reset-password" title="Reset password">Forgot your password?</a>
6265
{{/if}}
66+
{{/unless}}
6367
{{#unless errors}}
6468
{{#if error}}
6569
<p class="error">{{error}}</p>

0 commit comments

Comments
 (0)