1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 19:44:50 +09:00

Allow login using email address

This commit is contained in:
fr33domlover 2018-04-11 11:09:42 +00:00
parent c172784d61
commit d49b5d678c
5 changed files with 6 additions and 1 deletions

View file

@ -36,6 +36,7 @@ Person
UniquePersonIdent ident
UniquePersonLogin login
UniquePersonEmail email
SshKey
ident KyIdent

View file

@ -498,6 +498,7 @@ instance YesodAuthVerify App where
instance YesodAuthAccount AccountPersistDB' App where
emailVerifyKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
passphraseResetKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
allowLoginByEmailAddress _ = True
runAccountDB = unAccountPersistDB'
unregisteredLogin u = do
lift $ setUnverifiedCreds True $ Creds "account" (username u) []

View file

@ -126,6 +126,8 @@ changes =
, addFieldPrimRequired "Person" defaultTime "verifiedKeyCreated"
-- 21
, addFieldPrimRequired "Person" defaultTime "resetPassKeyCreated"
-- 22
, addUnique "Person" $ Unique "UniquePersonEmail" ["email"]
]
migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))

View file

@ -48,6 +48,7 @@ instance PersistUserCredentials Person where
userResetPwdKeyF = PersonResetPassKey
userResetPwdKeyCreatedF = Just PersonResetPassKeyCreated
uniqueUsername = UniquePersonLogin
uniqueEmail = Just UniquePersonEmail
-- 'Person' contains a sharer ID, so we can't let yesod-auth-account use
-- 'userCreate' to create a new user. Instead, override the default
-- implementation, where we can make sure to create a 'Sharer' and then a

View file

@ -18,7 +18,7 @@ packages:
# - '../yesod-auth-account'
- location:
git: https://dev.seek-together.space/s/fr33domlover/r/yesod-auth-account
commit: 31f8467d598d06d06d43917f42c035e53c2f3b46
commit: d44b85e979b52baaba346b236250a4a84dbd5c7f
extra-dep: true
- '../yesod-mail-send'