Allow login using email address
This commit is contained in:
parent
c172784d61
commit
d49b5d678c
5 changed files with 6 additions and 1 deletions
|
@ -36,6 +36,7 @@ Person
|
|||
|
||||
UniquePersonIdent ident
|
||||
UniquePersonLogin login
|
||||
UniquePersonEmail email
|
||||
|
||||
SshKey
|
||||
ident KyIdent
|
||||
|
|
|
@ -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) []
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue