Sha256: 6e7150b9da6a72d9b7106626f415a3f7d6ea32b3213977b0b12a01313e1e6731

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

module Multiauth
  class SessionsController < ApplicationController
    def new
    end

    def auth
      # see http://github.com/intridea/omniauth/wiki/Auth-Hash-Schema
      if logged_in?
        self.current_user.connect(params['auth'] || request.env['rack.auth'])
      else
        self.current_user = User.authenticate(params['auth'] || request.env['rack.auth'])
      end

      if logged_in?
        redirect_to session[:return_to] ? session[:return_to] : root_path
      else
        render 'new'
      end
    end

    def failure
      flash.now[:error] = params[:message]
      render 'new'
    end

    def destroy
      self.current_user = nil
      redirect_to root_path
    end

    protected
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multiauth-0.2.7 app/controllers/multiauth/sessions_controller.rb
multiauth-0.2.6 app/controllers/multiauth/sessions_controller.rb