Sha256: 97079b8f6556379b793abb151f19345267e84e738484717916ccf585113e0943

Contents?: true

Size: 871 Bytes

Versions: 9

Compression:

Stored size: 871 Bytes

Contents

# -*- coding: utf-8 -*-

# メール認証
class Auth::EmailController < ApplicationController
  filter_parameter_logging :password
  verify_method_post :only => [:login]

  # GET /auth/email
  def index
    session[:user_id] = nil
    @login_form = EmailLoginForm.new
  end

  # POST /auth/email/login
  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
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
multi_auth-0.2.0 app/controllers/auth/email_controller.rb
okkez-multi_auth-0.1.0 app/controllers/auth/email_controller.rb
multi_auth-0.1.0 app/controllers/auth/email_controller.rb
okkez-multi_auth-0.0.7 app/controllers/auth/email_controller.rb
multi_auth-0.0.7 app/controllers/auth/email_controller.rb
okkez-multi_auth-0.0.6 app/controllers/auth/email_controller.rb
multi_auth-0.0.6 app/controllers/auth/email_controller.rb
okkez-multi_auth-0.0.5 app/controllers/auth/email_controller.rb
multi_auth-0.0.5 app/controllers/auth/email_controller.rb