From d71581d8342d74a6048d703d5e274cd6dd57602c Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 4 Dec 2014 09:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BF=AE=E6=94=B9=E8=B5=84?= =?UTF-8?q?=E6=96=99=E6=97=B6=E6=8A=A5=E5=AF=86=E7=A0=81=E8=BF=87=E7=9F=AD?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 ++ app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 686f70a11..ad6d568a5 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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' diff --git a/app/models/user.rb b/app/models/user.rb index ef327f47f..29709519d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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