mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-09-30 00:28:23 +00:00
Allow to skip login page if a single oidc provider is configured
This commit is contained in:
@@ -36,6 +36,7 @@ type FormState
|
||||
| AuthFailed AuthResult
|
||||
| HttpError Http.Error
|
||||
| FormInitial
|
||||
| OidcLogoutPending
|
||||
|
||||
|
||||
type AuthStep
|
||||
|
@@ -85,13 +85,23 @@ update loginData flags msg model =
|
||||
session =
|
||||
Maybe.withDefault "" loginData.session
|
||||
in
|
||||
-- A value of 2 indicates that TOTP is required
|
||||
if loginData.openid == 2 then
|
||||
-- A value of 2 indicates that TOTP is required
|
||||
( { model | formState = FormInitial, authStep = StepOtp session, password = "" }
|
||||
, Cmd.none
|
||||
, Nothing
|
||||
)
|
||||
|
||||
else if loginData.openid == 3 then
|
||||
-- A valuo of 3 indicates a logout when a single
|
||||
-- openid provider is configured with
|
||||
-- oidcAutoredirect=true that doesn't have a logout
|
||||
-- url configured
|
||||
( { model | password = "", formState = OidcLogoutPending }
|
||||
, Ports.removeAccount ()
|
||||
, Just empty
|
||||
)
|
||||
|
||||
else
|
||||
( { model | password = "", formState = HttpError err }
|
||||
, Ports.removeAccount ()
|
||||
|
@@ -95,7 +95,7 @@ openIdLinks texts flags =
|
||||
div [ class "mt-3" ]
|
||||
[ B.horizontalDivider
|
||||
{ label = texts.or
|
||||
, topCss = "w-2/3 mb-4 hidden md:inline-flex w-full"
|
||||
, topCss = "w-full mb-4 hidden md:inline-flex w-full"
|
||||
, labelCss = "px-4 bg-gray-200 bg-opacity-50"
|
||||
, lineColor = "bg-gray-300 dark:bg-slate-600"
|
||||
}
|
||||
@@ -267,5 +267,10 @@ resultMessage texts model =
|
||||
[ text (texts.httpError err)
|
||||
]
|
||||
|
||||
OidcLogoutPending ->
|
||||
div [ class ("my-2 max-w-xs " ++ S.warnMessage) ]
|
||||
[ text texts.oidcLogoutPending
|
||||
]
|
||||
|
||||
FormInitial ->
|
||||
span [ class "hidden" ] []
|
||||
|
Reference in New Issue
Block a user