修正修改资料时报密码过短错误

This commit is contained in:
z9hang 2014-12-04 09:41:31 +08:00
parent f025922312
commit d71581d834
2 changed files with 3 additions and 1 deletions

View File

@ -138,6 +138,8 @@ class AccountController < ApplicationController
@user.password,@user.password_confirmation = password,password_confirmation
elsif !should_confirmation_password && !password.blank?
@user.password = password
else
@user.password = ""
end
case Setting.self_registration
when '1'

View File

@ -930,7 +930,7 @@ class User < Principal
def validate_password_length
# Password length validation based on setting
if password.nil? || password.size < Setting.password_min_length.to_i
if !password.nil? && password.size < Setting.password_min_length.to_i
errors.add(:password, :too_short, :count => Setting.password_min_length.to_i)
end
end