1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2025-03-20 04:46:22 +09:00

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
src/Vervis

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.