padrino-admin 0.9.27 → 0.9.28
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.
- data/lib/padrino-admin/generators/orm.rb +1 -1
- data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +11 -6
- data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +1 -1
- metadata +10 -10
|
@@ -11,8 +11,6 @@ class Account < CouchRest::Model::Base
|
|
|
11
11
|
property :role
|
|
12
12
|
|
|
13
13
|
view_by :email
|
|
14
|
-
view_by :id,
|
|
15
|
-
:map => "function(doc) {\n if ((doc['couchrest-type'] == 'Account') && doc['_id']) {\n emit(doc['_id'], null);\n }\n}\n"
|
|
16
14
|
|
|
17
15
|
# Validations
|
|
18
16
|
validates_presence_of :email, :role
|
|
@@ -40,6 +38,13 @@ class Account < CouchRest::Model::Base
|
|
|
40
38
|
::BCrypt::Password.new(crypted_password) == password
|
|
41
39
|
end
|
|
42
40
|
|
|
41
|
+
##
|
|
42
|
+
# This method is used by AuthenticationHelper
|
|
43
|
+
#
|
|
44
|
+
def self.find_by_id(id)
|
|
45
|
+
get(id)
|
|
46
|
+
end
|
|
47
|
+
|
|
43
48
|
private
|
|
44
49
|
def encrypt_password
|
|
45
50
|
self.crypted_password = ::BCrypt::Password.create(password)
|
|
@@ -51,13 +56,13 @@ class Account < CouchRest::Model::Base
|
|
|
51
56
|
|
|
52
57
|
def unique_email_validator
|
|
53
58
|
account = Account.find_by_email(email)
|
|
54
|
-
|
|
59
|
+
|
|
55
60
|
# didn't find email in the database
|
|
56
61
|
return if account.nil?
|
|
57
|
-
|
|
62
|
+
|
|
58
63
|
# account with same email in database is this account
|
|
59
64
|
return if has_key?('_id') && self['_id'] == account['_id']
|
|
60
|
-
|
|
65
|
+
|
|
61
66
|
errors.add(:email, "is not unique")
|
|
62
67
|
end
|
|
63
|
-
end
|
|
68
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: padrino-admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 3
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 9
|
|
9
|
-
-
|
|
10
|
-
version: 0.9.
|
|
9
|
+
- 28
|
|
10
|
+
version: 0.9.28
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Padrino Team
|
|
@@ -18,7 +18,7 @@ autorequire:
|
|
|
18
18
|
bindir: bin
|
|
19
19
|
cert_chain: []
|
|
20
20
|
|
|
21
|
-
date: 2011-05-
|
|
21
|
+
date: 2011-05-11 00:00:00 Z
|
|
22
22
|
dependencies:
|
|
23
23
|
- !ruby/object:Gem::Dependency
|
|
24
24
|
name: padrino-core
|
|
@@ -28,12 +28,12 @@ dependencies:
|
|
|
28
28
|
requirements:
|
|
29
29
|
- - "="
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
hash:
|
|
31
|
+
hash: 3
|
|
32
32
|
segments:
|
|
33
33
|
- 0
|
|
34
34
|
- 9
|
|
35
|
-
-
|
|
36
|
-
version: 0.9.
|
|
35
|
+
- 28
|
|
36
|
+
version: 0.9.28
|
|
37
37
|
type: :runtime
|
|
38
38
|
version_requirements: *id001
|
|
39
39
|
- !ruby/object:Gem::Dependency
|
|
@@ -44,12 +44,12 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
hash:
|
|
47
|
+
hash: 3
|
|
48
48
|
segments:
|
|
49
49
|
- 0
|
|
50
50
|
- 9
|
|
51
|
-
-
|
|
52
|
-
version: 0.9.
|
|
51
|
+
- 28
|
|
52
|
+
version: 0.9.28
|
|
53
53
|
type: :runtime
|
|
54
54
|
version_requirements: *id002
|
|
55
55
|
description: Admin View for Padrino applications
|