Make the registration switch work again

This commit is contained in:
fr33domlover 2019-03-04 08:14:36 +00:00
parent 9c3cb27619
commit ad034dbacc
2 changed files with 17 additions and 2 deletions

View file

@ -544,9 +544,24 @@ instance YesodAuthAccount AccountPersistDB' App where
passphraseResetKeyDuration _ = Just $ fromTimeUnit (1 :: Day)
allowLoginByEmailAddress _ = True
runAccountDB = unAccountPersistDB'
unregisteredLogin u = do
unregisteredLogin u = do
setUnverifiedCreds True $ Creds "account" (username u) []
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
-- achieve customized and internationalized form validation messages.

View file

@ -27,7 +27,7 @@ packages:
# - lib/yesod-auth-account
- location:
git: https://dev.angeley.es/s/fr33domlover/r/yesod-auth-account
commit: c14795264c3d63b2126e91e98107a631405cea74
commit: 4dcd84c4007212540c76113ca2fd5bf0dd9ead5f
extra-dep: true
- lib/yesod-http-signature
- lib/yesod-mail-send