Class: UsersController

Inherits:
InheritedResources::Base
  • Object
show all
Defined in:
app/controllers/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



7
8
9
# File 'app/controllers/users_controller.rb', line 7

def edit
  respond_with(resource)
end

#resourceObject



33
34
35
# File 'app/controllers/users_controller.rb', line 33

def resource
  @user ||= FullyValidatedUser.find(current_user)
end

#updateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/users_controller.rb', line 11

def update
  if params[:commit] == "Update Account"
    @user = User.find(params[:id])
    update! do |success, failure|
      failure.html{redirect_to }
      success.html{flash[:notice] = "Your account has been updated."; redirect_to root_url}
    end
  else
    @user = User.find(params[:id])
    @user.password = params[:user]["password"]
    @user.save
    flash[:notice] = "Your password has been changed."
    redirect_to root_url
  end
end

#verifyObject



27
28
29
30
31
# File 'app/controllers/users_controller.rb', line 27

def verify
  respond_with resource do |format|
    format.json {render :json=> resource.valid_password?(params[:password]).to_json}
  end
end