diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ff1cb0bad3ee..6e3347945822 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2740,7 +2740,7 @@ auths.oauth2_emailURL = Email URL auths.skip_local_two_fa = Skip local 2FA auths.skip_local_two_fa_helper = Leaving unset means local users with 2FA set will still have to pass 2FA to log on auths.force_o_auth = Force login via this authentication -auths.force_o_auth_helper = Set this to automatically redirect sign in to this OAuth provider +auths.force_o_auth_helper = Set this to automatically redirect sign in to this OAuth provider (unless ?noredirect=true is set) auths.oauth2_tenant = Tenant auths.oauth2_scopes = Additional Scopes auths.oauth2_required_claim_name = Required Claim Name diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index a213c695d3ed..1ce9a6af766f 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -139,6 +139,9 @@ func checkAutoLogin(ctx *context.Context) bool { func checkForceOAuth(ctx *context.Context) bool { // Check if authentication is forced to OAuth + if ctx.FormBool("noredirect") { + return false + } authSources, err := auth.GetActiveOAuth2ProviderSources() if err != nil {