GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of rails/open_id_authentication
Description: open_id_collection is better, this is kaput. :)
Homepage: http://rubyonrails.org
Clone URL: git://github.com/samsm/open_id_authentication.git
Moved some logic from controller to plugin.
Sam Schenkman-Moore (author)
Sun Apr 27 16:17:53 -0700 2008
commit  9c56d99649a994cecaa421f3f173797a99427e77
tree    192b604f48724197674bdbc6f541f812677b4efa
parent  ecacf0e5ae90062b3d6194816674d47ea5aef646
...
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
...
21
22
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
25
0
@@ -21,49 +21,4 @@ class SessionsController < ApplicationController
0
     redirect_back_or_default
0
   end
0
   
0
- protected
0
-
0
- def open_id_authentication
0
- authenticate_with_open_id(params[:openid_url],:optional => [:fullname,:nickname]) do |result, identity_url, registration|
0
- if result.successful?
0
- if @identity = Identity.find_or_create_by_url(identity_url)
0
-
0
- # Undelete profile when identity logs in.
0
- @identity.update_attribute('deleted_at', nil) if @identity.deleted_at
0
-
0
- # Use simple registration if possible
0
- if (update_registration?(registration))
0
- @identity.fullname = registration['fullname']
0
- @identity.nickname = registration['nickname']
0
- @identity.save
0
- end
0
- successful_login
0
- else
0
- failed_login "Sorry, no user by that identity URL exists (#{identity_url})"
0
- end
0
- else
0
- failed_login result.message
0
- end
0
- end
0
- end
0
-
0
- private
0
-
0
- def update_registration?(registration)
0
- unless @identity.ignore_sreg?
0
- (@identity.fullname != registration['fullname'] or
0
- registration['nickname'] != @identity.nickname)
0
- end
0
- end
0
-
0
- def successful_login
0
- current_identities << @identity
0
- session_update
0
- redirect_to('/')
0
- end
0
-
0
- def failed_login(message)
0
- flash[:error] = message
0
- redirect_to(new_session_url)
0
- end
0
 end
0
\ No newline at end of file
...
14
15
16
 
 
 
17
...
14
15
16
17
18
19
20
0
@@ -14,4 +14,7 @@ end
0
 
0
 config.to_prepare do
0
   ActionController::Base.send :include, OpenIdAuthentication
0
+ ActionController::Base.send :include, IdentitySessions
0
+ ActionController::Base.send :include, IdentitiesSystem
0
+ ActionView::Base.send :include, OpenidHelper
0
 end

Comments

    No one has commented yet.