Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginController < ApplicationController
- protect_from_forgery :only => [:create, :update, :destroy]
- layout 'main'
- def index
- @title = "Login"
- @custom_styles = []
- end
- def login
- @user = User.find_all_by_username(params[:username])
- if @user.length == 1
- if @user[0].password == params[:password]
- @real_user = @user[0]
- else
- @real_user = User.find(2)
- end
- else
- @real_user = User.find(2)
- end
- end
- if @real_user == User.find(2)
- redirect_to :action => index
- else
- redirect_to :controller => 'write', :action => 'index'
- end
- end
Add Comment
Please, Sign In to add comment