Sha256: c51198b676d307cd3b8dee8f7b0be1542e321efcd220e2c440972e5406062635

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

class PasswordChangeController < ApplicationController
  before_filter :require_token

  def show
    respond_to do |format|
      format.json { head :no_content }
      format.html
    end
  end

  def create
    if @user.change_password(params[:password], params[:password_confirmation])
      login(@user)

      respond_to do |format|
        format.json { head :no_content }
        format.html {
          flash.now[:notice] = "Password updated successfully"
          redirect_to(root_path)
        }
      end
    else
      respond_to do |format|
        format.json { render json: { status: 'error', errors: @user.errors }.to_json, status: 422 }
        format.html { render :show }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authkit-0.2.1 lib/generators/authkit/templates/app/controllers/password_change_controller.rb
authkit-0.0.1 lib/generators/authkit/templates/app/controllers/password_change_controller.rb