app: add page titles

This commit is contained in:
Sam Dodrill 2015-01-07 09:10:16 -08:00
parent 36de093dd7
commit b03bd4b7c4
1 changed files with 18 additions and 2 deletions

View File

@ -40,13 +40,26 @@ class App extends lapis.Application
@params.registrar_password = encoding.encode_base64 encoding.hmac_sha1(@params.email, os.time!) @params.registrar_password = encoding.encode_base64 encoding.hmac_sha1(@params.email, os.time!)
if Users\find email: @params.email if Users\find email: @params.email
@title = "Failure"
return status: 500, "User with that email already exists" return status: 500, "User with that email already exists"
user = Users\create @params user = Users\create @params
user\write_session @ user\write_session @
@session.sippw = @params.registrar_password
"Hi " .. user.name @title = "Success"
@html ->
h1 "Success"
p ->
text "Your email is " .. user.email
p ->
text "Your extension is " .. user.id
p ->
text "Your sip password is "
code user.registrar_password
p "This will not be shown again so please be sure to write this down."
} }
[login: "/login"]: capture_errors respond_to { [login: "/login"]: capture_errors respond_to {
@ -68,8 +81,11 @@ class App extends lapis.Application
if user.password == cmppass if user.password == cmppass
user\write_session @ user\write_session @
@title = "Login successful"
return "Hi " .. user.name return "Hi " .. user.name
else else
@title = "Login failure"
return status: 500, "bad password" return status: 500, "bad password"
} }