Class: AuthController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AuthController
- Defined in:
- app/controllers/auth_controller.rb
Instance Method Summary collapse
- #auth_form ⇒ Object
- #forgot ⇒ Object
- #index ⇒ Object
- #login ⇒ Object
- #logout ⇒ Object
- #needs_profile ⇒ Object
- #resend_validation ⇒ Object
Instance Method Details
#auth_form ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/auth_controller.rb', line 26 def auth_form respond_to do |format| format.js { render :layout => false } end end |
#forgot ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/auth_controller.rb', line 58 def forgot ActionMailer::Base.[:host] = request.host @account = Account.find_by_email_address(params[:email]) if not @account.nil? @account.generate_password else flash[:error_messages] = ["There's no account matching that email address. Please try again, or sign up for an account."] redirect_to :action => :forgot_form end end |
#index ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/auth_controller.rb', line 6 def index respond_to do |format| format.css { render :layout => false } end end |
#login ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/auth_controller.rb', line 12 def login if request.post? unless @login.password or @login.have_password return redirect_to(:controller => "account", :action => "signup", :email => @login.email) end unless logged_in? if attempt_login(@login) successful_login_redirect end end end end |
#logout ⇒ Object
82 83 84 85 |
# File 'app/controllers/auth_controller.rb', line 82 def logout reset_session redirect_to :back end |
#needs_profile ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/auth_controller.rb', line 32 def needs_profile @person = Person.find session[:provisional_person] if @person.nil? flash[:error_messages] = ["Couldn't find a person record with that ID. Something may have gone wrong internally. Please try again, and if the problem persists, please contact the site administrator."] return redirect_to(:back) end if not AeUsers.signup_allowed? flash[:error_messages] = ['Your account is not valid for this site.'] redirect_to url_for("/") else if not AeUsers.profile_class.nil? @app_profile = AeUsers.profile_class.send(:new, :person_id => session[:provisional_person]) @app_profile.attributes = params[:app_profile] if request.post? @app_profile.save session[:person] = @person redirect_to params[:return_to] end end end end |
#resend_validation ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/controllers/auth_controller.rb', line 70 def resend_validation ActionMailer::Base.[:host] = request.host @email_address = Account.find params[:email] if not @email_address.nil? @email_address.generate_validation else flash[:error_messages] = ["Email address #{params[:email]} not found!"] redirect_to url_for("/") end end |