diff --git a/messages/campus/de.msg b/messages/campus/de.msg index 5fdf477b7..9a4b384fc 100644 --- a/messages/campus/de.msg +++ b/messages/campus/de.msg @@ -1,4 +1,4 @@ -CampusIdentNote: Campus-Kennung bitte inkl. Domain-Teil (@campus.lmu.de) angeben. +CampusIdentPlaceholder: Vorname.Nachname@campus.lmu.de CampusIdent: Campus-Kennung CampusPassword: Passwort CampusSubmit: Abschicken diff --git a/src/Auth/LDAP.hs b/src/Auth/LDAP.hs index 74c669f3c..320ab6e27 100644 --- a/src/Auth/LDAP.hs +++ b/src/Auth/LDAP.hs @@ -33,7 +33,7 @@ data CampusLogin = CampusLogin , campusPassword :: Text } deriving (Generic, Typeable) -data CampusMessage = MsgCampusIdentNote +data CampusMessage = MsgCampusIdentPlaceholder | MsgCampusIdent | MsgCampusPassword | MsgCampusSubmit @@ -117,10 +117,16 @@ campusUser' conf pool User{userIdent} campusForm :: ( RenderMessage site FormMessage , RenderMessage site CampusMessage , Button site ButtonSubmit - ) => AForm (HandlerT site IO) CampusLogin -campusForm = CampusLogin - <$> areq ciField (fslpI MsgCampusIdent "user.name@campus.lmu.de" & setTooltip MsgCampusIdentNote & addAttr "autofocus" "") Nothing - <*> areq passwordField (fslI MsgCampusPassword) Nothing + ) => WForm (HandlerT site IO) (FormResult CampusLogin) +campusForm = do + MsgRenderer mr <- getMsgRenderer + + ident <- wreq ciField (fslpI MsgCampusIdent (mr MsgCampusIdentPlaceholder) & addAttr "autofocus" "") Nothing + password <- wreq passwordField (fslI MsgCampusPassword) Nothing + + return $ CampusLogin + <$> ident + <*> password apLdap :: Text apLdap = "LDAP" @@ -137,7 +143,7 @@ campusLogin conf@LdapConf{..} pool = AuthPlugin{..} apName = apLdap apDispatch :: Text -> [Text] -> HandlerT Auth (HandlerT site IO) TypedContent apDispatch "POST" [] = do - ((loginRes, _), _) <- lift . runFormPost $ renderAForm FormStandard campusForm + ((loginRes, _), _) <- lift . runFormPost $ renderWForm FormStandard campusForm case loginRes of FormFailure errs -> do forM_ errs $ addMessage Error . toHtml @@ -169,7 +175,7 @@ campusLogin conf@LdapConf{..} pool = AuthPlugin{..} loginErrorMessageI LoginR Msg.AuthError apDispatch _ _ = notFound apLogin toMaster = do - (login, loginEnctype) <- handlerToWidget . generateFormPost $ renderAForm FormStandard campusForm + (login, loginEnctype) <- handlerToWidget . generateFormPost $ renderWForm FormStandard campusForm let loginForm = wrapForm login FormSettings { formMethod = POST , formAction = Just . SomeRoute . toMaster $ PluginR "LDAP" []