summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/user.rb7
-rw-r--r--app/views/my/password.html.erb2
2 files changed, 4 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 5978f06de..3ecf03c18 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -323,13 +323,12 @@ class User < Principal
return auth_source.allow_password_changes?
end
+ # Returns true if the user password has expired
def password_expired?
- changed_on = self.passwd_changed_on || Time.at(0)
- period = Setting.password_max_age.to_i
-
- if period.zero?
+ if Setting.password_max_age.to_i.zero?
false
else
+ changed_on = self.passwd_changed_on || Time.at(0)
changed_on < period.days.ago
end
end
diff --git a/app/views/my/password.html.erb b/app/views/my/password.html.erb
index 6ba2bfc40..7a411e51a 100644
--- a/app/views/my/password.html.erb
+++ b/app/views/my/password.html.erb
@@ -17,7 +17,7 @@
<%= submit_tag l(:button_apply) %>
<% end %>
-<% unless @user.must_change_passwd? || @user.password_expired? %>
+<% unless @user.must_change_password? %>
<% content_for :sidebar do %>
<%= render :partial => 'sidebar' %>
<% end %>