mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 19:14:51 +09:00
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
|
UniquePersonIdent ident
|
||||||
UniquePersonLogin login
|
UniquePersonLogin login
|
||||||
|
UniquePersonEmail email
|
||||||
|
|
||||||
SshKey
|
SshKey
|
||||||
ident KyIdent
|
ident KyIdent
|
||||||
|
|
|
@ -498,6 +498,7 @@ instance YesodAuthVerify App where
|
||||||
instance YesodAuthAccount AccountPersistDB' App where
|
instance YesodAuthAccount AccountPersistDB' App where
|
||||||
emailVerifyKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
|
emailVerifyKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
|
||||||
passphraseResetKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
|
passphraseResetKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
|
||||||
|
allowLoginByEmailAddress _ = True
|
||||||
runAccountDB = unAccountPersistDB'
|
runAccountDB = unAccountPersistDB'
|
||||||
unregisteredLogin u = do
|
unregisteredLogin u = do
|
||||||
lift $ setUnverifiedCreds True $ Creds "account" (username u) []
|
lift $ setUnverifiedCreds True $ Creds "account" (username u) []
|
||||||
|
|
|
@ -126,6 +126,8 @@ changes =
|
||||||
, addFieldPrimRequired "Person" defaultTime "verifiedKeyCreated"
|
, addFieldPrimRequired "Person" defaultTime "verifiedKeyCreated"
|
||||||
-- 21
|
-- 21
|
||||||
, addFieldPrimRequired "Person" defaultTime "resetPassKeyCreated"
|
, addFieldPrimRequired "Person" defaultTime "resetPassKeyCreated"
|
||||||
|
-- 22
|
||||||
|
, addUnique "Person" $ Unique "UniquePersonEmail" ["email"]
|
||||||
]
|
]
|
||||||
|
|
||||||
migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))
|
migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))
|
||||||
|
|
|
@ -48,6 +48,7 @@ instance PersistUserCredentials Person where
|
||||||
userResetPwdKeyF = PersonResetPassKey
|
userResetPwdKeyF = PersonResetPassKey
|
||||||
userResetPwdKeyCreatedF = Just PersonResetPassKeyCreated
|
userResetPwdKeyCreatedF = Just PersonResetPassKeyCreated
|
||||||
uniqueUsername = UniquePersonLogin
|
uniqueUsername = UniquePersonLogin
|
||||||
|
uniqueEmail = Just UniquePersonEmail
|
||||||
-- 'Person' contains a sharer ID, so we can't let yesod-auth-account use
|
-- 'Person' contains a sharer ID, so we can't let yesod-auth-account use
|
||||||
-- 'userCreate' to create a new user. Instead, override the default
|
-- 'userCreate' to create a new user. Instead, override the default
|
||||||
-- implementation, where we can make sure to create a 'Sharer' and then a
|
-- implementation, where we can make sure to create a 'Sharer' and then a
|
||||||
|
|
|
@ -18,7 +18,7 @@ packages:
|
||||||
# - '../yesod-auth-account'
|
# - '../yesod-auth-account'
|
||||||
- location:
|
- location:
|
||||||
git: https://dev.seek-together.space/s/fr33domlover/r/yesod-auth-account
|
git: https://dev.seek-together.space/s/fr33domlover/r/yesod-auth-account
|
||||||
commit: 31f8467d598d06d06d43917f42c035e53c2f3b46
|
commit: d44b85e979b52baaba346b236250a4a84dbd5c7f
|
||||||
extra-dep: true
|
extra-dep: true
|
||||||
- '../yesod-mail-send'
|
- '../yesod-mail-send'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue