Class: AuthenticationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/authentications_controller.rb

Overview

Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.


Instance Method Summary collapse

Methods inherited from ApplicationController

#auto_complete

Instance Method Details

#createObject Also known as: update




34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/controllers/authentications_controller.rb', line 34

def create
  @authentication = Authentication.new(params[:authentication])

  if @authentication.save && !@authentication.user.suspended?
    flash[:notice] = t(:msg_welcome)
    if @authentication.user. > 1 && @authentication.user.
      flash[:notice] << " " << t(:msg_last_login, l(@authentication.user., :format => :mmddhhss))
    end
    redirect_back_or_default root_url
  else
    if @authentication.user && @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

#destroyObject




59
60
61
62
63
# File 'app/controllers/authentications_controller.rb', line 59

def destroy
  current_user_session.destroy
  flash[:notice] = t(:msg_goodbye)
  redirect_back_or_default 
end

#newObject




24
25
26
# File 'app/controllers/authentications_controller.rb', line 24

def new
  @authentication = Authentication.new
end

#showObject




29
30
31
# File 'app/controllers/authentications_controller.rb', line 29

def show
  redirect_to 
end