Guest User

Untitled

a guest
Mar 13th, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. local admin = {}
  2. local access = require "sailor.access"
  3.  
  4. -- by default the cred is admin, demo. to change read docs
  5. -- TODO: add proper comment here
  6.  
  7.  
  8. function admin.index(page)
  9. page:render('index')
  10. end
  11.  
  12. function admin.login(page)
  13. -- if (page.POST.username =="admin" and page.POST.password =='demo') then
  14. -- page:redirect('admin/dash')
  15. if(page.POST.username =="admin") then
  16. access.login(page.POST.username , page.POST.passoword)
  17. page:redirect('admin/dash')
  18.  
  19. -- elseif (access.login(page.POST.username , page.POST.passoword)) then
  20.  
  21. else page:render('login')
  22. end
  23.  
  24. end
  25.  
  26.  
  27. function admin.dash(page)
  28. if access.is_guest() return 404
  29. else
  30. page:render('dash')
  31. end
  32. -- body
  33. end
  34.  
  35. function admin.logout(page)
  36. access.logout()
  37. page:render('logout')
  38. -- body
  39. end
  40.  
  41.  
  42. return admin
Add Comment
Please, Sign In to add comment