Guest User

Untitled

a guest
Mar 7th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <-- Section from schema generated by my migration -->
  2. create_table "users", :force => true do |t|
  3. t.column "username", :string
  4. t.column "email", :string
  5. t.column "hash", :string
  6. end
  7.  
  8. <!-- Section in the controller where i get user from db -->
  9. def login
  10. if request.post?
  11. @user = User.find_by_email(params[:email])
  12. puts "User hash: #{@user.hash}"
  13. if @user.password == params[:password]
  14. flash[:notice] = 'User was successfully logged in. '
  15. flash[:notice] = @user.hash
  16. redirect_to :action => 'list'
  17. else
  18. flash[:notice] = 'User was unsuccessfully logged in.'
  19. redirect_to :action => 'list'
  20. end
  21. end
  22. end
  23.  
  24. <!-- @user.hash return a number instead of the whole string -->
Add Comment
Please, Sign In to add comment