Class: AuthenticationsController

Inherits:
ApplicationController show all
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

Methods inherited from ApplicationController

#auto_complete

Instance Method Details

#createObject Also known as: update




22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/authentications_controller.rb', line 22

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




47
48
49
50
51
# File 'app/controllers/authentications_controller.rb', line 47

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

#newObject




12
13
14
# File 'app/controllers/authentications_controller.rb', line 12

def new
  @authentication = Authentication.new
end

#showObject




17
18
19
# File 'app/controllers/authentications_controller.rb', line 17

def show
  redirect_to 
end