Class: Auth::NameController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Auth::NameController
- Defined in:
- app/controllers/auth/name_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /auth/name.
-
#login ⇒ Object
POST /auth/name/login.
Instance Method Details
#index ⇒ Object
GET /auth/name
6 7 8 9 |
# File 'app/controllers/auth/name_controller.rb', line 6 def index session[:user_id] = nil @login_form = NameLoginForm.new end |
#login ⇒ Object
POST /auth/name/login
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/auth/name_controller.rb', line 12 def login session[:user_id] = nil @login_form = NameLoginForm.new(params[:login_form]) if @login_form.valid? @name_credential = @login_form.authenticate end if @name_credential @name_credential.login! @login_user = @name_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 name or the password is wrong.")) render(:action => "index") end end |