From d1e1f25162a3f3d7fc3b5b9987e57ae8249347ff Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 29 Feb 2024 17:52:31 +0100 Subject: [PATCH] chore(login): use correct auth plugin identifiers for comparison in login template --- src/Foundation/Instances.hs | 1 + src/Foundation/Yesod/Auth.hs | 4 ++-- templates/login.hamlet | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Foundation/Instances.hs b/src/Foundation/Instances.hs index a217bf91c..f2a87dd9a 100644 --- a/src/Foundation/Instances.hs +++ b/src/Foundation/Instances.hs @@ -20,6 +20,7 @@ import qualified Yesod.Core.Unsafe as Unsafe import qualified Yesod.Auth.Message as Auth import Utils.Form +import Auth.OAuth2 (apAzure, apAzureMock) import Auth.LDAP import Auth.PWHash import Auth.Dummy diff --git a/src/Foundation/Yesod/Auth.hs b/src/Foundation/Yesod/Auth.hs index 942845cb4..394f4aed4 100644 --- a/src/Foundation/Yesod/Auth.hs +++ b/src/Foundation/Yesod/Auth.hs @@ -50,10 +50,10 @@ authenticate :: ( MonadHandler m, HandlerSite m ~ UniWorX => Creds UniWorX -> m (AuthenticationResult UniWorX) authenticate creds@Creds{..} = liftHandler . runDB . withReaderT projectBackend $ do - $logErrorS "Auth" $ "\a\27[31m" <> tshow creds <> "\27[0m" -- TODO: debug only + $logErrorS "Auth Debug" $ "\a\27[31m" <> tshow creds <> "\27[0m" -- TODO: debug only setSessionJson SessionOAuth2Token $ (getAccessToken creds, getRefreshToken creds) sess <- getSession - $logErrorS "OAuth" $ "\27[34m" <> tshow sess <> "\27[0m" -- TODO: debug only + $logErrorS "OAuth session Debug" $ "\27[34m" <> tshow sess <> "\27[0m" -- TODO: debug only now <- liftIO getCurrentTime userAuthConf <- getsYesod $ view _appUserAuthConf diff --git a/templates/login.hamlet b/templates/login.hamlet index bb3ee704e..cbb45e165 100644 --- a/templates/login.hamlet +++ b/templates/login.hamlet @@ -1,28 +1,28 @@ $newline never -$# SPDX-FileCopyrightText: 2022-2024 Gregor Kleen ,David Mosbach +$# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Gregor Kleen , David Mosbach $# $# SPDX-License-Identifier: AGPL-3.0-or-later $forall AuthPlugin{apName, apLogin} <- plugins - $if apName == "azureadv2" + $if apName == apAzure

Azure ^{apLogin toParent} - $elseif apName == "dev-oauth2-mock" + $elseif apName == apAzureMock

_{MsgDummyLoginTitle} ^{apLogin toParent} - $elseif apName == "LDAP" + $elseif apName == apLdap

_{MsgLDAPLoginTitle} ^{apLogin toParent} - $elseif apName == "PWHash" + $elseif apName == apHash

_{MsgPWHashLoginTitle}

_{MsgPWHashLoginNote} ^{apLogin toParent} - $elseif apName == "dummy" + $elseif apName == apDummy

_{MsgDummyLoginTitle} ^{apLogin toParent}