padrino-admin 0.9.27 → 0.9.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,4 +95,4 @@ module Padrino
95
95
  end # Orm
96
96
  end # Generators
97
97
  end # Admin
98
- end # Padrino
98
+ end # Padrino
@@ -35,4 +35,4 @@ class Account < ActiveRecord::Base
35
35
  def password_required
36
36
  crypted_password.blank? || password.present?
37
37
  end
38
- end
38
+ end
@@ -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
@@ -52,4 +52,4 @@ class Account
52
52
  def encrypt_password
53
53
  self.crypted_password = ::BCrypt::Password.create(password) if password.present?
54
54
  end
55
- end
55
+ end
@@ -50,4 +50,4 @@ class Account
50
50
  def password_required
51
51
  crypted_password.blank? || self.password.present?
52
52
  end
53
- end
53
+ end
@@ -43,4 +43,4 @@ class Account
43
43
  def password_required
44
44
  crypted_password.blank? || password.present?
45
45
  end
46
- end
46
+ end
@@ -49,4 +49,4 @@ class Account < ::Sequel::Model
49
49
  def password_required
50
50
  crypted_password.blank? || password.present?
51
51
  end
52
- end
52
+ 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: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 27
10
- version: 0.9.27
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-06 00:00:00 Z
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: 13
31
+ hash: 3
32
32
  segments:
33
33
  - 0
34
34
  - 9
35
- - 27
36
- version: 0.9.27
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: 13
47
+ hash: 3
48
48
  segments:
49
49
  - 0
50
50
  - 9
51
- - 27
52
- version: 0.9.27
51
+ - 28
52
+ version: 0.9.28
53
53
  type: :runtime
54
54
  version_requirements: *id002
55
55
  description: Admin View for Padrino applications