Class: Auth::LoginController
- Inherits:
-
BaseController
- Object
- BaseController
- Auth::LoginController
- Defined in:
- app/controllers/auth/login_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/auth/login_controller.rb', line 19 def create if @user && @user.can_login?(params) login_as @user respond_to do |format| format.html { redirect_back_or_default } format.js end else if @user flash[:error] = @user.errors..values.flatten.join(' ') else flash[:error] = t('errors.messages.wrong_name_or_password') end respond_to do |format| format.html { redirect_back fallback_location: login_url } format.js { render :new } end end end |
#destroy ⇒ Object
42 43 44 45 |
# File 'app/controllers/auth/login_controller.rb', line 42 def destroy logout redirect_to root_url end |
#new ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/auth/login_controller.rb', line 4 def new @user = User.new store_location request.referer if request.referer.present? unless request.xhr? || params[:form_id] @local = true end respond_to do |format| format.html.phone format.html format.js end end |