Class: Users::OmniauthCallbacksController

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

Instance Method Summary collapse

Instance Method Details

#GadzOrgObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/users/omniauth_callbacks_controller.rb', line 4

def GadzOrg

    @data=request.env['omniauth.auth']

    # @data={"provider"=>"GadzOrg",
    #       "uid"=>"thomas.fuzeau.2008",
    #       "info"=>{"email"=>"[email protected]"},
    #       "credentials"=>{"ticket"=>"ST-364828-uc7TFKGJDcIOY0upGxE0-cas"},
    #       "extra"=>
    #       {"user"=>"thomas.fuzeau.2008",
    #       "last_change"=>"2012-08-29",
    #       "sex"=>"male",
    #       "centre"=>"CER de Metz",
    #       "promo"=>"X2008",
    #       "lastname"=>"Fuzeau",
    #       "firstname"=>"Thomas",
    #       "directory_name"=>"Fuzeau Thomas",
    #       "type"=>"gadz",
    #       "ddp"=>"zgo,www",
    #       "display_name"=>"Thomas",
    #       "ensamid"=>"20081398",
    #       "username"=>"thomas.fuzeau.2008",
    #       "is_admin"=>"false",
    #       "allproms"=>"81-21.me208",
    #       "registration_date"=>"2012-08-06 22:15:16.0",
    #       "pgtype"=>"pg",
    #       "soce_id"=>"66273",
    #       "full_name"=>"Thomas Fuzeau"}}
    data = request.env['omniauth.auth']

    @user = User.omniauth(data)

    return redirect_to root_path, flash:{error: "Impossible d'identifier cet utilisateur"} unless @user

    if @user.persisted?
         @user, :event => :authentication
    else
        flash[:alert] = I18n.t 'omniauth.error'
        redirect_to new_user_registration_url
    end

end