user signup can now be disabled

This commit is contained in:
nek0 2014-12-08 15:47:19 +01:00
parent d4c8ac6d42
commit e226802379
2 changed files with 57 additions and 45 deletions

View file

@ -8,13 +8,21 @@ import Data.Maybe
getSignupR :: Handler Html getSignupR :: Handler Html
getSignupR = do getSignupR = do
-- (signupWidget, enctype) <- generateFormPost signupForm block <- fmap extraSignupBlocked appExtra
case block of
False -> do
defaultLayout $ do defaultLayout $ do
setTitle "Eidolon :: Signup" setTitle "Eidolon :: Signup"
$(widgetFile "signup") $(widgetFile "signup")
True -> do
setMessage "User signup has been disabled"
redirect $ HomeR
postSignupR :: Handler Html postSignupR :: Handler Html
postSignupR = do postSignupR = do
block <- fmap extraSignupBlocked appExtra
case block of
False -> do
mUserName <- lookupPostParam "username" mUserName <- lookupPostParam "username"
newUserName <- case validateLen (fromJust mUserName) of newUserName <- case validateLen (fromJust mUserName) of
True -> return $ fromJust $ mUserName True -> return $ fromJust $ mUserName
@ -57,6 +65,9 @@ postSignupR = do
_ -> do _ -> do
setMessage "This user already exists" setMessage "This user already exists"
redirect $ SignupR redirect $ SignupR
True -> do
setMessage "User signup is disabled"
redirect $ HomeR
validateLen :: Text -> Bool validateLen :: Text -> Bool
validateLen a = validateLen a =

View file

@ -3,7 +3,8 @@ Default: &defaults
port: 3000 port: 3000
approot: "http://localhost:3000" approot: "http://localhost:3000"
copyright: Insert copyright statement here copyright: Insert copyright statement here
#analytics: UA-YOURCODE #enter only True or False
signupBlocked: False
Development: Development:
<<: *defaults <<: *defaults