Class: Authentifyd::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
Localyzed::LocalyzedController
Defined in:
app/controllers/authentifyd/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#build_resource(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/authentifyd/registrations_controller.rb', line 28

def build_resource(*args)
  super

  @user.language = I18n.locale

  if session[:omniauth]
    @user.apply_omniauth(session[:omniauth])
    @user.valid?
  end
end

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/authentifyd/registrations_controller.rb', line 14

def create
  build_resource

  if session[:omniauth] && @user.errors[:email][0] =~ /has already been taken/
    user = Authentifyd::User.find_by_email(@user.email)
    # Link Accounts - if via social connect
    return redirect_to link_accounts_url(user.id)
  end

  # normal processing
  super
  session[:omniauth] = nil unless @user.new_record?
end

#newObject



8
9
10
11
12
# File 'app/controllers/authentifyd/registrations_controller.rb', line 8

def new
  # Building the resource with information that MAY BE available from omniauth!
  build_resource(:email => session[:omniauth_email])
  render :new
end