Sha256: 765d29b63154b06b39859cc085015203880166848327ac08e8c48cff6d8a7e53
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
class UsersController < InheritedResources::Base respond_to :html, :js, :only=>[:edit, :show, :update] respond_to :json, :only=>[:verify_password] before_filter :authenticate_user!, :resource def edit resource.old_password respond_with(resource) end def update update!(:notice=>"Your password has been updated.") {root_url} end def verify respond_with @user do |format| format.json {render :json=> @user.valid_password?(params[:password]).to_json} end end def resource a = ValidatorCallbacks.new @user ||= lambda{ user = User.find(current_user) user.class_eval do attr_accessor :old_password validates :old_password, :presence=>true , :password=>true validates :password, :presence=>true , :length=>{:minimum=>6} validates :password_confirmation, :equal_to=>{:other=>:password} end user }.call end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wheels-0.0.42 | app/controllers/users_controller.rb |