Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <-- Section from schema generated by my migration -->
- create_table "users", :force => true do |t|
- t.column "username", :string
- t.column "email", :string
- t.column "hash", :string
- end
- <!-- Section in the controller where i get user from db -->
- def login
- if request.post?
- @user = User.find_by_email(params[:email])
- puts "User hash: #{@user.hash}"
- if @user.password == params[:password]
- flash[:notice] = 'User was successfully logged in. '
- flash[:notice] = @user.hash
- redirect_to :action => 'list'
- else
- flash[:notice] = 'User was unsuccessfully logged in.'
- redirect_to :action => 'list'
- end
- end
- end
- <!-- @user.hash return a number instead of the whole string -->
Add Comment
Please, Sign In to add comment