mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							17 lines
						
					
					
						
							567 B
						
					
					
				
			
		
		
	
	
							17 lines
						
					
					
						
							567 B
						
					
					
				# frozen_string_literal: true
 | 
						|
 | 
						|
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
 | 
						|
  def google_oauth2
 | 
						|
    @user = Users.from_omniauth(request.env['omniauth.auth'])
 | 
						|
 | 
						|
    if @user.persisted?
 | 
						|
      flash[:notice] = I18n.t('devise.omniauth_callbacks.success', kind: 'Google')
 | 
						|
 | 
						|
      sign_in_and_redirect @user, event: :authentication
 | 
						|
    else
 | 
						|
      redirect_to new_registration_path(oauth_callback: true, user: @user.slice(:email, :first_name, :last_name)),
 | 
						|
                  notice: 'Please complete registration with Google auth'
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |