app/models/user.rb
# Runs various validation checks and then saves the new password.
#
# Returns: Boolean
#
# The order of various validity checks here is important,
# see numbered comments below.
Runs various validation checks and then saves the new password.
Returns: Boolean

The order of various validity checks here is important,
see numbered comments below.
Runs various validation checks and then saves the new password . Returns : Boolean The order of various validity checks here is important see numbered comments below .
def update_password_confirm_current(params)
    current_password_valid = valid_password?(params[:current_password])
    unless password_updatable?
      errors.add(:base, :password_not_updatable)
      return false
    end
    self.password = params[:password].strip
    valid? 
    errors.add(:current_password, :incorrect) unless current_password_valid
    errors.add(:password, :empty) if params[:password].blank?
    errors.add(:password, :password_too_short) if params[:password] && params[:password].strip.length < 10
    errors.add(:password_confirmation, :confirmation) if params[:password] != params[:password_confirmation]
    if errors.empty?
      clear_reset_password_token
      save!
      return true
    else
      return false
    end
  end
def update_password_confirm_current ( params ) current_password_valid = valid_password? ( params [ :current_password ] ) unless password_updatable? errors . add ( :base , :password_not_updatable ) return false end self . password = params [ :password ] . strip valid? errors . add ( :current_password , :incorrect ) unless current_password_valid errors . add ( :password , :empty ) if params [ :password ] . blank? errors . add ( :password , :password_too_short ) if params [ :password ] && params [ :password ] . strip . length < 10 errors . add ( :password_confirmation , :confirmation ) if params [ :password ] != params [ :password_confirmation ] if errors . empty? clear_reset_password_token save! return true else return false end end
Runs various validation checks and then saves the new password.
Runs various validation checks and then saves the new password .
# 1) Must run this check before the password is set to a new value, # but we can't set errors until after calling #valid? # 2) Bail if somehow the user should be using SSO # 3) Set the password so devise-security can check password complexity # clears any existing errors # 4) Add more validation errors as needed
params
<not_specific>