@@ -259,7 +259,7 class User < Principal | |||||
259 |
|
259 | |||
260 | # Does the backend storage allow this user to change their password? |
|
260 | # Does the backend storage allow this user to change their password? | |
261 | def change_password_allowed? |
|
261 | def change_password_allowed? | |
262 |
return true if auth_source |
|
262 | return true if auth_source.nil? | |
263 | return auth_source.allow_password_changes? |
|
263 | return auth_source.allow_password_changes? | |
264 | end |
|
264 | end | |
265 |
|
265 | |||
@@ -621,8 +621,9 class User < Principal | |||||
621 | end |
|
621 | end | |
622 |
|
622 | |||
623 | class AnonymousUser < User |
|
623 | class AnonymousUser < User | |
624 |
|
624 | validate :validate_anonymous_uniqueness, :on => :create | ||
625 | def validate_on_create |
|
625 | ||
|
626 | def validate_anonymous_uniqueness | |||
626 | # There should be only one AnonymousUser in the database |
|
627 | # There should be only one AnonymousUser in the database | |
627 | errors.add :base, 'An anonymous user already exists.' if AnonymousUser.find(:first) |
|
628 | errors.add :base, 'An anonymous user already exists.' if AnonymousUser.find(:first) | |
628 | end |
|
629 | end |
General Comments 0
You need to be logged in to leave comments.
Login now