wheels 0.0.44 → 0.0.45
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/users_controller.rb +1 -6
- data/app/models/user.rb +8 -10
- data/lib/wheels/password_validators.rb +1 -1
- data/wheels.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.45
|
@@ -5,7 +5,6 @@ class UsersController < InheritedResources::Base
|
|
5
5
|
before_filter :authenticate_user!, :resource
|
6
6
|
|
7
7
|
def edit
|
8
|
-
resource.old_password
|
9
8
|
respond_with(resource)
|
10
9
|
end
|
11
10
|
|
@@ -20,11 +19,7 @@ class UsersController < InheritedResources::Base
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def resource
|
23
|
-
@user ||=
|
24
|
-
user = User.find(current_user)
|
25
|
-
user.extend(PasswordValidators)
|
26
|
-
user
|
27
|
-
}.call
|
22
|
+
@user ||= FullyValidatedUser.find(current_user)
|
28
23
|
end
|
29
24
|
end
|
30
25
|
|
data/app/models/user.rb
CHANGED
@@ -6,16 +6,6 @@ class User < ActiveRecord::Base
|
|
6
6
|
has_many :galleries, :dependent => :destroy
|
7
7
|
has_many :access_control_entries, :dependent=>:destroy
|
8
8
|
|
9
|
-
validates :email, :presence => true
|
10
|
-
|
11
|
-
def validates_password
|
12
|
-
class_eval do
|
13
|
-
attr_accessor :old_password
|
14
|
-
validates :old_password, :presence=>true , :password=>true
|
15
|
-
validates :password, :presence=>true , :length=>{:minimum=>6}
|
16
|
-
validates :password_confirmation, :equal_to=>{:other=>:password}
|
17
|
-
end
|
18
|
-
end
|
19
9
|
|
20
10
|
def self.nobody
|
21
11
|
User.new(:role=>Role.nobody)
|
@@ -60,3 +50,11 @@ class User < ActiveRecord::Base
|
|
60
50
|
|
61
51
|
end
|
62
52
|
|
53
|
+
class FullyValidatedUser < User
|
54
|
+
attr_accessor :old_password
|
55
|
+
validates :email, :presence => true, :email => true
|
56
|
+
validates :old_password, :presence=>true , :password=>true
|
57
|
+
validates :password, :presence=>true , :length=>{:minimum=>6}
|
58
|
+
validates :password_confirmation, :equal_to=>{:other=>:password}
|
59
|
+
end
|
60
|
+
|
data/wheels.gemspec
CHANGED