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