diff --git a/app.js b/app.js index d41d433f..295fbad2 100644 --- a/app.js +++ b/app.js @@ -253,6 +253,15 @@ app.locals.authProviders = { allowEmailRegister: config.allowEmailRegister } +// If none of the form-based methods (LDAP, Email, OpenID) are configured and +// exactly one redirect-style external provider is, skip the "Choose method" +// dialog and link "Sign In" straight to that provider's login page. +const externalProviderKeys = ['facebook', 'twitter', 'github', 'gitlab', 'mattermost', 'dropbox', 'google', 'saml', 'oauth2'] +const enabledExternalProviders = externalProviderKeys.filter((key) => app.locals.authProviders[key]) +app.locals.authProviders.autoLoginProvider = (!app.locals.authProviders.ldap && !app.locals.authProviders.email && !app.locals.authProviders.openID && enabledExternalProviders.length === 1) + ? enabledExternalProviders[0] + : null + // Export/Import menu items app.locals.enableDropBoxSave = config.isDropboxEnable app.locals.enableGitHubGist = config.isGitHubEnable diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md index 5679c7f5..1deea67c 100644 --- a/public/docs/release-notes.md +++ b/public/docs/release-notes.md @@ -1,5 +1,11 @@ # Release Notes +## 1.x.x UNRELEASED + +### Enhancements + +- Automatically skip the login modal if no form-based login and exactly one external login provider is configured + ## 1.11.1 2026-07-24 ### Security fixes diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index 41f37015..c19372b1 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -15,7 +15,9 @@ <% if (allowAnonymous && !disableNoteCreation) { %> <%= __('New guest note') %> <% } %> - <% if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %> + <% if (authProviders.autoLoginProvider) { %> + <%= __('Sign In') %> + <% } else if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %> <% } %> @@ -52,7 +54,13 @@ <% if (errorMessage && errorMessage.length > 0) { %>
<%= errorMessage %>
<% } %> - <% if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %> + <% if (authProviders.autoLoginProvider) { %> + +
+ <%= __('Sign In') %> +
+ <%= __('or') %> + <% } else if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %>
<%= __('Sign In') %>