Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local admin = {}
- local access = require "sailor.access"
- -- by default the cred is admin, demo. to change read docs
- -- TODO: add proper comment here
- function admin.index(page)
- page:render('index')
- end
- function admin.login(page)
- -- if (page.POST.username =="admin" and page.POST.password =='demo') then
- -- page:redirect('admin/dash')
- if(page.POST.username =="admin") then
- access.login(page.POST.username , page.POST.passoword)
- page:redirect('admin/dash')
- -- elseif (access.login(page.POST.username , page.POST.passoword)) then
- else page:render('login')
- end
- end
- function admin.dash(page)
- if access.is_guest() return 404
- else
- page:render('dash')
- end
- -- body
- end
- function admin.logout(page)
- access.logout()
- page:render('logout')
- -- body
- end
- return admin
Add Comment
Please, Sign In to add comment