Sprankelprachtig aan/afmeldsysteem

authentication_controller.rb 937B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. class AuthenticationController < ApplicationController
  2. def login_form
  3. render layout: 'void'
  4. end
  5. def login
  6. if params[:session][:email].blank? || params[:session][:password].blank?
  7. flash[:warning] = "You forgot to add value"
  8. else
  9. u = User.find_by(email: params[:session][:email])
  10. if u && u.authenticate(params[:session][:password])
  11. # TODO Login logic here
  12. flash[:success] = "Hello, #{u.person.full_name}!"
  13. else
  14. flash[:danger] = "Invalid username/password combination!"
  15. end
  16. end
  17. redirect_to action: 'login_form'
  18. end
  19. def create_password_form
  20. render layout: 'void'
  21. end
  22. def create_password
  23. flash[:danger] = "Not yet implemented."
  24. redirect_to action: 'login'
  25. end
  26. def forgotten_password_form
  27. render layout: 'void'
  28. end
  29. def forgotten_password
  30. flash[:danger] = "Not yet implemented."
  31. redirect_to action: 'login'
  32. end
  33. end