A corporation manager and dashboard for EVE Online
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

users_controller.rb 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. class UsersController < ApplicationController
  2. def signup
  3. if request.post?
  4. # do user create logic
  5. redirect_to root_url
  6. end
  7. end
  8. def login
  9. if request.post?
  10. if params[:username].nil? || params[:username].empty? ||
  11. params[:password].nil? || params[:password].empty?
  12. flash.now[:alert] = 'Both a character name and password are required.'
  13. render 'login' and return
  14. end
  15. user = User.find_by(name: params[:username])
  16. if user.nil? || !user.authenticate(params[:password])
  17. flash.now[:alert] = 'Incorrect character name or password.'
  18. render 'login' and return
  19. end
  20. flash.now[:alert] = 'Login successful.'
  21. render 'login' and return
  22. # redirect_to root_url
  23. end
  24. end
  25. def logout
  26. if request.post?
  27. # do user logout logic
  28. redirect_to root_url
  29. end
  30. end
  31. def reset
  32. if request.post?
  33. # do user reset logic
  34. end
  35. end
  36. end