authentasaurus 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
|
@@ -59,10 +59,13 @@ class AuthentasaurusViewsGenerator < Rails::Generator::NamedBase
|
|
59
59
|
# User invitations
|
60
60
|
if options[:invitable]
|
61
61
|
m.directory File.join('app/views', class_path, "user_invitations")
|
62
|
+
m.directory File.join('app/views', class_path, "registrations")
|
62
63
|
|
63
64
|
#Views
|
64
65
|
m.file 'views/user_invitations/index.html.erb', File.join('app/views', class_path, 'user_invitations', "index.html.erb")
|
65
66
|
m.file 'views/user_invitations/new.html.erb', File.join('app/views', class_path, 'user_invitations', "new.html.erb")
|
67
|
+
|
68
|
+
m.file 'views/registrations/new.html.erb', File.join('app/views', class_path, 'registrations', "new.html.erb")
|
66
69
|
|
67
70
|
m.file 'views/authentasaurus_emailer/invitation_mail.html.erb', File.join("app/views", class_path, "authentasaurus_emailer", "invitation_mail.html.erb")
|
68
71
|
end
|
@@ -7,8 +7,12 @@ module ActiveResource::ActsAsAuthenticatable
|
|
7
7
|
module ClassMethods
|
8
8
|
## Authenticates the username and password
|
9
9
|
def authenticate(username, password)
|
10
|
-
|
11
|
-
|
10
|
+
case(self.format)
|
11
|
+
when ActiveResource::Formats::XmlFormat
|
12
|
+
user = self.new Hash.from_xml(self.post(:signin,:username => username, :password => password).body).values.first
|
13
|
+
when ActiveResource::Formats::JsonFormat
|
14
|
+
user = self.new ActiveSupport::JSON.decode(self.post(:signin,:username => username, :password => password).body)
|
15
|
+
else
|
12
16
|
user = self.new Hash.from_xml(self.post(:signin,:username => username, :password => password).body).values.first
|
13
17
|
end
|
14
18
|
|
@@ -17,7 +21,9 @@ module ActiveResource::ActsAsAuthenticatable
|
|
17
21
|
last_update = user.attributes.delete "updated_at"
|
18
22
|
local_user = self.sync_to.find_or_initialize_by_username user.username, user.attributes
|
19
23
|
|
20
|
-
|
24
|
+
last_update_datetime = (last_update.kind_of?(String)) ? (DateTime.parse(last_update)) : (last_update)
|
25
|
+
|
26
|
+
if local_user.updated_at < last_update_datetime
|
21
27
|
local_user.update_attributes user.attributes
|
22
28
|
end
|
23
29
|
end
|
@@ -12,7 +12,7 @@ module ActiveResource::Authenticatable
|
|
12
12
|
self.site = options[:site] || AUTHENTASAURUS[:modules][:remote][self.name.underscore.gsub(/_sync/, "").to_sym][:site]
|
13
13
|
self.element_name = options[:session_element].try(:to_s) || AUTHENTASAURUS[:modules][:remote][self.name.underscore.gsub(/_sync/, "").to_sym][:session_element]
|
14
14
|
self.sync = options[:sync] || AUTHENTASAURUS[:modules][:remote][self.name.underscore.gsub(/_sync/, "").to_sym][:sync]
|
15
|
-
self.sync_to = options[:sync_to].try(:to_s).try(:camelize).try(:constantize)
|
15
|
+
self.sync_to = options[:sync_to].try(:to_s).try(:camelize).try(:constantize) || AUTHENTASAURUS[:modules][:remote][self.name.underscore.gsub(/_sync/, "").to_sym][:sync_to].camelize.constantize
|
16
16
|
|
17
17
|
|
18
18
|
# include authentication methods
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authentasaurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Omar Mekky
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- app/controllers/user_invitations_controller.rb
|
43
43
|
- app/controllers/users_controller.rb
|
44
44
|
- app/controllers/validations_controller.rb
|
45
|
+
- app/controllers/authentasaurus/authentasaurus_controller.rb
|
45
46
|
- app/models/area.rb
|
46
47
|
- app/models/authentasaurus_emailer.rb
|
47
48
|
- app/models/group.rb
|
@@ -132,7 +133,6 @@ files:
|
|
132
133
|
- lib/authentasaurus/models/user_invitation.rb
|
133
134
|
- lib/authentasaurus/models/validation.rb
|
134
135
|
- lib/authentasaurus/areas_controller.rb
|
135
|
-
- lib/authentasaurus/authentasaurus_controller.rb
|
136
136
|
- lib/authentasaurus/groups_controller.rb
|
137
137
|
- lib/authentasaurus/permissions_controller.rb
|
138
138
|
- lib/authentasaurus/recoveries_controller.rb
|