Class: AuthenticationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AuthenticationsController
- Defined in:
- app/controllers/authentications_controller.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Instance Method Summary collapse
-
#create ⇒ Object
(also: #update)
—————————————————————————-.
-
#destroy ⇒ Object
—————————————————————————-.
-
#new ⇒ Object
—————————————————————————-.
-
#show ⇒ Object
—————————————————————————-.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object Also known as: update
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/authentications_controller.rb', line 23 def create @authentication = Authentication.new(params[:authentication].permit(:username, :password, :remember_me)) if @authentication.save && !@authentication.user.suspended? flash[:notice] = t(:msg_welcome) if @authentication.user.login_count > 1 && @authentication.user.last_login_at? flash[:notice] += " " + t(:msg_last_login, l(@authentication.user.last_login_at, format: :mmddhhss)) end redirect_back_or_default root_url else if @authentication.user&.awaits_approval? flash[:notice] = t(:msg_account_not_approved) else flash[:warning] = t(:msg_invalig_login) end redirect_to action: :new end end |
#destroy ⇒ Object
48 49 50 51 52 |
# File 'app/controllers/authentications_controller.rb', line 48 def destroy current_user_session.destroy flash[:notice] = t(:msg_goodbye) redirect_back_or_default login_url end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/authentications_controller.rb', line 13 def new @authentication = Authentication.new end |
#show ⇒ Object
18 19 20 |
# File 'app/controllers/authentications_controller.rb', line 18 def show redirect_to login_url end |