test session data
This commit is contained in:
parent
fb52546f99
commit
fe27710421
7
app.moon
7
app.moon
|
@ -10,8 +10,9 @@ import respond_to from require "lapis.application"
|
|||
require "models.user"
|
||||
|
||||
class App extends lapis.Application
|
||||
"/": =>
|
||||
render: "index"
|
||||
[index: "/"]: =>
|
||||
@user = @session.user
|
||||
render: true
|
||||
|
||||
[list: "/list"]: =>
|
||||
user = Users\find id: @session.user
|
||||
|
@ -38,7 +39,7 @@ class App extends lapis.Application
|
|||
@params.extension = "9001"
|
||||
|
||||
if Users\find email: @params.email
|
||||
return "User with that email already exists"
|
||||
return status: 500, "User with that email already exists"
|
||||
|
||||
user = Users\create @params
|
||||
user\write_session @
|
||||
|
|
|
@ -5,3 +5,6 @@ class Index extends Widget
|
|||
h1 class: "header", "Hello"
|
||||
div class: "body", ->
|
||||
text "Welcome to my site!"
|
||||
|
||||
if @user
|
||||
h2, "I think you are UID #{@user}"
|
||||
|
|
Loading…
Reference in New Issue