app: add page titles
This commit is contained in:
parent
36de093dd7
commit
b03bd4b7c4
20
app.moon
20
app.moon
|
@ -40,13 +40,26 @@ class App extends lapis.Application
|
|||
@params.registrar_password = encoding.encode_base64 encoding.hmac_sha1(@params.email, os.time!)
|
||||
|
||||
if Users\find email: @params.email
|
||||
@title = "Failure"
|
||||
return status: 500, "User with that email already exists"
|
||||
|
||||
user = Users\create @params
|
||||
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 {
|
||||
|
@ -68,8 +81,11 @@ class App extends lapis.Application
|
|||
if user.password == cmppass
|
||||
user\write_session @
|
||||
|
||||
@title = "Login successful"
|
||||
|
||||
return "Hi " .. user.name
|
||||
else
|
||||
@title = "Login failure"
|
||||
return status: 500, "bad password"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue