Class: Users::OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/users/omniauth_callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#google_appsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/users/omniauth_callbacks_controller.rb', line 4

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"
     @user, event: :authentication
  else
    session["devise.google_data"] = request.env["omniauth.auth"]
    redirect_to new_user_registration_url
  end
end

#google_oauth2Object



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

def google_oauth2
  google_apps
end