diff --git a/src/Handler/Admin/OAuth2.hs b/src/Handler/Admin/OAuth2.hs index 27a29b461..cf99ab5cf 100644 --- a/src/Handler/Admin/OAuth2.hs +++ b/src/Handler/Admin/OAuth2.hs @@ -15,34 +15,33 @@ import Import getAdminOAuth2R, postAdminOAuth2R :: Handler Html getAdminOAuth2R = postAdminOAuth2R -postAdminOAuth2R = error "postAdminOAuth2R not yet implemented" --- ((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminLdapLookup"::Text) $ \html -> --- flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing --- --- let procFormPerson :: Text -> Handler (Maybe ()) --- procFormPerson lid = error "TODO" --- --- --- ((uresult, uwidget), uenctype) <- runFormPost $ identifyForm ("adminLdapUpsert"::Text) $ \html -> --- flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing --- let procFormUpsert :: Text -> Handler (Maybe (Either CampusUserConversionException (Entity User))) --- procFormUpsert lid = pure <$> runDB (try $ ldapLookupAndUpsert lid) --- mbLdapUpsert <- formResultMaybe uresult procFormUpsert --- --- --- actionUrl <- fromMaybe AdminLdapR <$> getCurrentRoute --- siteLayoutMsg MsgMenuLdap $ do --- setTitleI MsgMenuLdap --- let personForm = wrapForm pwidget def --- { formAction = Just $ SomeRoute actionUrl --- , formEncoding = penctype --- } --- upsertForm = wrapForm uwidget def --- { formAction = Just $ SomeRoute actionUrl --- , formEncoding = uenctype --- } --- presentUtf8 lv = Text.intercalate ", " (either tshow id . Text.decodeUtf8' <$> lv) --- presentLatin1 lv = Text.intercalate ", " ( Text.decodeLatin1 <$> lv) --- --- -- TODO: use i18nWidgetFile instead if this is to become permanent --- $(widgetFile "ldap") +postAdminOAuth2R = + ((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminOAuth2Lookup"::Text) $ \html -> + flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing + + let procFormPerson :: Text -> Handler (Maybe ()) + procFormPerson lid = error "TODO" + + ((uresult, uwidget), uenctype) <- runFormPost $ identifyForm ("adminOAuth2Upsert"::Text) $ \html -> + flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing + let procFormUpsert :: Text -> Handler (Maybe (Either CampusUserConversionException (Entity User))) + procFormUpsert lid = pure <$> runDB (try $ ldapLookupAndUpsert lid) + mbLdapUpsert <- formResultMaybe uresult procFormUpsert + + + actionUrl <- fromMaybe AdminLdapR <$> getCurrentRoute + siteLayoutMsg MsgMenuLdap $ do + setTitleI MsgMenuLdap + let personForm = wrapForm pwidget def + { formAction = Just $ SomeRoute actionUrl + , formEncoding = penctype + } + upsertForm = wrapForm uwidget def + { formAction = Just $ SomeRoute actionUrl + , formEncoding = uenctype + } + presentUtf8 lv = Text.intercalate ", " (either tshow id . Text.decodeUtf8' <$> lv) + presentLatin1 lv = Text.intercalate ", " ( Text.decodeLatin1 <$> lv) + + -- TODO: use i18nWidgetFile instead if this is to become permanent + $(widgetFile "oauth2")