mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 18:34:52 +09:00
Make the registration switch work again
This commit is contained in:
parent
9c3cb27619
commit
ad034dbacc
2 changed files with 17 additions and 2 deletions
|
@ -544,9 +544,24 @@ instance YesodAuthAccount AccountPersistDB' App where
|
||||||
passphraseResetKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
|
passphraseResetKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
|
||||||
allowLoginByEmailAddress _ = True
|
allowLoginByEmailAddress _ = True
|
||||||
runAccountDB = unAccountPersistDB'
|
runAccountDB = unAccountPersistDB'
|
||||||
unregisteredLogin u = do
|
|
||||||
|
unregisteredLogin u = do
|
||||||
setUnverifiedCreds True $ Creds "account" (username u) []
|
setUnverifiedCreds True $ Creds "account" (username u) []
|
||||||
return mempty
|
return mempty
|
||||||
|
registrationAllowed = do
|
||||||
|
settings <- getsYesod appSettings
|
||||||
|
if appRegister settings
|
||||||
|
then do
|
||||||
|
room <- case appAccounts settings of
|
||||||
|
Nothing -> return True
|
||||||
|
Just cap -> do
|
||||||
|
current <- runDB $ count ([] :: [Filter Person])
|
||||||
|
return $ current < cap
|
||||||
|
return $
|
||||||
|
if room
|
||||||
|
then Nothing
|
||||||
|
else Just $ setMessage "Maximal number of registered users reached"
|
||||||
|
else return $ Just $ setMessage "User registration disabled"
|
||||||
|
|
||||||
-- This instance is required to use forms. You can modify renderMessage to
|
-- This instance is required to use forms. You can modify renderMessage to
|
||||||
-- achieve customized and internationalized form validation messages.
|
-- achieve customized and internationalized form validation messages.
|
||||||
|
|
|
@ -27,7 +27,7 @@ packages:
|
||||||
# - lib/yesod-auth-account
|
# - lib/yesod-auth-account
|
||||||
- location:
|
- location:
|
||||||
git: https://dev.angeley.es/s/fr33domlover/r/yesod-auth-account
|
git: https://dev.angeley.es/s/fr33domlover/r/yesod-auth-account
|
||||||
commit: c14795264c3d63b2126e91e98107a631405cea74
|
commit: 4dcd84c4007212540c76113ca2fd5bf0dd9ead5f
|
||||||
extra-dep: true
|
extra-dep: true
|
||||||
- lib/yesod-http-signature
|
- lib/yesod-http-signature
|
||||||
- lib/yesod-mail-send
|
- lib/yesod-mail-send
|
||||||
|
|
Loading…
Reference in a new issue