Skip to content

Instantly share code, notes, and snippets.

@kelhusseiny
Created April 20, 2012 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelhusseiny/2426093 to your computer and use it in GitHub Desktop.
Save kelhusseiny/2426093 to your computer and use it in GitHub Desktop.
class SessionsController < ApplicationController
def login
#Login Form
end
def login_attempt
authorized_user = User.authenticate(params[:username_or_email],params[:login_password])
if authorized_user
flash[:notice] = "Wow Welcome again, you logged in as #{authorized_user.username}"
redirect_to(:action => 'home')
else
flash[:notice] = "Invalid Username or Password"
flash[:color]= "invalid"
render "login"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment