Sha256: b84a50176ea44cbff8080a5d5f60da16c2a762acf33b3936521c3e325e197ef2

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 Bytes

Contents

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  skip_before_filter :verify_authenticity_token, only: [:google_apps, :google_oauth2]

  def google_apps
    if UserVerifier.respond_to?(:verified?)
      if !UserVerifier.verified?(request.env["omniauth.auth"])
        render file: File.join(Tawork::Engine.root, "public/401.html"), 
          layout: false
        return
      end
    end

    @user = User.find_for_open_id(request.env["omniauth.auth"], current_user)

    if @user.persisted?
      flash[:notice] = I18n.t "devise.omniauth_callbacks.success", kind: "Google"
      sign_in_and_redirect @user, event: :authentication
    else
      session["devise.google_data"] = request.env["omniauth.auth"]
      redirect_to new_user_registration_url
    end
  end

  def google_oauth2
    google_apps
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tawork-0.0.50 app/controllers/users/omniauth_callbacks_controller.rb
tawork-0.0.49 app/controllers/users/omniauth_callbacks_controller.rb
tawork-0.0.48 app/controllers/users/omniauth_callbacks_controller.rb
tawork-0.0.47 app/controllers/users/omniauth_callbacks_controller.rb