Guest User

Untitled

a guest
May 1st, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class LoginController < ApplicationController
  2. protect_from_forgery :only => [:create, :update, :destroy]
  3. layout 'main'
  4.  
  5. def index
  6. @title = "Login"
  7. @custom_styles = []
  8. end
  9.  
  10. def login
  11. @user = User.find_all_by_username(params[:username])
  12. if @user.length == 1
  13. if @user[0].password == params[:password]
  14. @real_user = @user[0]
  15. else
  16. @real_user = User.find(2)
  17. end
  18. else
  19. @real_user = User.find(2)
  20. end
  21. end
  22. if @real_user == User.find(2)
  23. redirect_to :action => index
  24. else
  25. redirect_to :controller => 'write', :action => 'index'
  26. end
  27. end
Add Comment
Please, Sign In to add comment