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.
 
 
 
 
 

50 lignes
1.2 KiB

  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].blank? || params[:password].blank?
  11. flash.now[:alert] = 'Both a character name and password are required.'
  12. render 'login' and return
  13. end
  14. user = User.find_by(name: params[:username])
  15. if user.nil? || !user.authenticate(params[:password])
  16. flash.now[:alert] = 'Incorrect character name or password.'
  17. render 'login' and return
  18. end
  19. allow_non_corp = AdminSettings.get_bool(:allow_non_corp)
  20. if !allow_non_corp && !user.in_corp? && !user.admin?
  21. corp_name = AdminSettings.get_bool(:corp_name)
  22. flash[:alert] = "You are not a member of #{corp_name}, and access to "\
  23. "this site is disallowed for non-corp members."
  24. redirect_to root_url and return
  25. end
  26. session[:user_id] = user.id
  27. flash[:notice] = 'Login successful!'
  28. redirect_to root_url
  29. end
  30. end
  31. def logout
  32. if request.post?
  33. # do user logout logic
  34. redirect_to root_url
  35. end
  36. end
  37. def reset
  38. if request.post?
  39. # do user reset logic
  40. end
  41. end
  42. end