app/controllers/users_controller.rb
#
# Updates user's password.
#

Updates user's password.
Updates user ' s password .
def update_password
    assert_params_must_have :id
    @user.password = params[:user][:password]
    @user.password_confirmation = params[:user][:password_confirmation]
    if @user.valid?
      if @user.save
        flash[:notice] = "Password has been successfully updated"
        redirect_to :action => :index
      else
        flash[:error] = "Updating error"
        @user.password = nil
        @user.password_confirmation = nil
        render :action => 'edit_password'
      end
    else
      @user.password = nil
      @user.password_confirmation = nil
      render :action => 'edit_password'
    end
  end
def update_password assert_params_must_have :id @user . password = params [ :user ] [ :password ] @user . password_confirmation = params [ :user ] [ :password_confirmation ] if @user . valid? if @user . save flash [ :notice ] = "Password has been successfully updated" redirect_to :action => :index else flash [ :error ] = "Updating error" @user . password = nil @user . password_confirmation = nil render :action => 'edit_password' end else @user . password = nil @user . password_confirmation = nil render :action => 'edit_password' end end
Updates user's password.
Updates user ' s password .