Class: Auth::EmailController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Auth::EmailController
- Defined in:
- app/controllers/auth/email_controller.rb
Overview
メール認証
Instance Method Summary collapse
-
#index ⇒ Object
GET /auth/email.
-
#login ⇒ Object
POST /auth/email/login.
Instance Method Details
#index ⇒ Object
GET /auth/email
9 10 11 12 |
# File 'app/controllers/auth/email_controller.rb', line 9 def index session[:user_id] = nil @login_form = EmailLoginForm.new end |
#login ⇒ Object
POST /auth/email/login
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/auth/email_controller.rb', line 15 def login session[:user_id] = nil @login_form = EmailLoginForm.new(params[:login_form]) if @login_form.valid? @email_credential = @login_form.authenticate end if @email_credential @email_credential.login! @login_user = @email_credential.user session[:user_id] = @login_user.id redirect_to(:controller => "/auth", :action => "logged_in") else @login_form.password = nil set_error_now(p_("MultiAuth", "The email address or the password is wrong.")) render(:action => "index") end end |