Sha256: 04eec07a3de589cec14682a816e35ff16ccb97580b792f99616280313d34062c
Contents?: true
Size: 1.39 KB
Versions: 13
Compression:
Stored size: 1.39 KB
Contents
module Carnival class OmniauthCallbacksController < Devise::OmniauthCallbacksController def facebook # You need to implement the method below in your model (e.g. app/models/user.rb) @user = Carnival::AdminUser.find_for_omni_auth(request.env["omniauth.auth"]) if @user.nil? flash.notice = I18n.t("user_not_found") redirect_to new_admin_user_session_path elsif @user.persisted? sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format? else session["devise.facebook_data"] = request.env["omniauth.auth"] redirect_to new_user_registration_url end end def google_oauth2 @user = Carnival::AdminUser.find_for_omni_auth(request.env["omniauth.auth"]) if @user.nil? flash.notice = I18n.t("user_not_found") redirect_to new_admin_user_session_path elsif @user.persisted? flash.notice = "Signed in Through Google!" sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated else session["devise.user_attributes"] = @user.attributes flash.notice = "You are almost Done! Please provide a password to finish setting up your account" redirect_to new_user_registration_url end end end end
Version data entries
13 entries across 13 versions & 1 rubygems