app/controllers/clientsportal_controller.rb
def login
        if request.get?
            session[:client_id] = nil
            @log_client = ClientsLogin.new
        else
            logged_in_client = ClientsLogin.authorize(params[:log_client][:login], params[:log_client][:password])
            if logged_in_client.kind_of? Client
                if logged_in_client.is_inactive?
                    flash[:error] = "Your account is currently inactive"
                else
                    session[:client_id] = logged_in_client.id
                    session[:client_login] = params[:log_client][:login]
                    redirect_to(:action => "index")
                end
            else
                session[:client_id] = nil
                flash[:error] = "Invalid client login/password combination"
            end
        end
    end
#
# Action is responsible for logging client. 
# If successful then user is redirected to index action.
#
Action is responsible for logging client.
If successful then user is redirected to index action.
Action is responsible for logging client . If successful then user is redirected to index action .
def login
        if request.get?
            session[:client_id] = nil
            @log_client = ClientsLogin.new
        else
            logged_in_client = ClientsLogin.authorize(params[:log_client][:login], params[:log_client][:password])
            if logged_in_client.kind_of? Client
                if logged_in_client.is_inactive?
                    flash[:error] = "Your account is currently inactive"
                else
                    session[:client_id] = logged_in_client.id
                    session[:client_login] = params[:log_client][:login]
                    redirect_to(:action => "index")
                end
            else
                session[:client_id] = nil
                flash[:error] = "Invalid client login/password combination"
            end
        end
    end
def login if request . get? session [ :client_id ] = nil @log_client = ClientsLogin . new else logged_in_client = ClientsLogin . authorize ( params [ :log_client ] [ :login ] , params [ :log_client ] [ :password ] ) if logged_in_client . kind_of? Client if logged_in_client . is_inactive? flash [ :error ] = "Your account is currently inactive" else session [ :client_id ] = logged_in_client . id session [ :client_login ] = params [ :log_client ] [ :login ] redirect_to ( :action => "index" ) end else session [ :client_id ] = nil flash [ :error ] = "Invalid client login/password combination" end end end
Action is responsible for logging client.
Action is responsible for logging client .