diff --git a/src/Foundation/Yesod/Auth.hs b/src/Foundation/Yesod/Auth.hs index 9e9aa85c6..f31fc4a1e 100644 --- a/src/Foundation/Yesod/Auth.hs +++ b/src/Foundation/Yesod/Auth.hs @@ -182,7 +182,6 @@ upsertCampusUser upsertMode ldapData = do userDefaultConf <- getsYesod $ view _appUserDefaults (newUser,userUpdate) <- decodeUser now userDefaultConf upsertMode ldapData - --TODO: newUser should be associated with a company and company supervisor through Handler.Utils.Company.oldUpsertUserCompany, but this is called by upsertAvsUser already - conflict? oldUsers <- for (userLdapPrimaryKey newUser) $ \pKey -> selectKeysList [ UserLdapPrimaryKey ==. Just pKey ] [] @@ -230,8 +229,8 @@ decodeUserTest mbIdent ldapData = do decodeUser :: (MonadThrow m) => UTCTime -> UserDefaultConf -> UpsertCampusUserMode -> Ldap.AttrList [] -> m (User,_) decodeUser now UserDefaultConf{..} upsertMode ldapData = do let - userTelephone = decodeLdap ldapUserTelephone - userMobile = decodeLdap ldapUserMobile + userTelephone = decodeLdap ldapUserTelephone <&> canonicalPhone + userMobile = decodeLdap ldapUserMobile <&> canonicalPhone userCompanyPersonalNumber = decodeLdap ldapUserFraportPersonalnummer userCompanyDepartment = decodeLdap ldapUserFraportAbteilung diff --git a/src/Utils/Mail.hs b/src/Utils/Mail.hs index 5085efcf6..667d93548 100644 --- a/src/Utils/Mail.hs +++ b/src/Utils/Mail.hs @@ -84,7 +84,13 @@ canonicalPhone pn | otherwise = Text.map repl_nondigit pn where + -- split_area :: Text -> Char -> Int -> Text -> Text + -- split_area c f p n = + -- let (area,sufx) = Text.splitAt p $ Text.filter Char.isDigit n + -- in c <> Text.cons f area <> Text.cons ' ' sufx + german_mobile :: Text -> Text + --german_mobile = split_area "+49" '1' 2 german_mobile wpx = let (area,endnr) = Text.splitAt 2 $ Text.filter Char.isDigit wpx in "+49 1" <> area <> Text.cons ' ' endnr