Sha256: 40c9479e9c1701d65fa17d60601a5c0570979da5c952bb654a7b2d5956a315d4

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

class Underworld::Dashboard::ProfileController < ::ApplicationController
  layout false
  def show
    @user = current_user
    respond_with(@user)
  end

  def update
    @user = ::Underworld::User.find(current_user.id)
    authorize @user
    respond_to do |f|
      if @user.update_without_password(resource_params)
        f.js { }
        f.html { }
      else
        @errors = @user.errors
        f.js {render :errors}
        f.html
      end
    end

  end


  # GET /sites/new
  def edit_password
    @user = ::Underworld::User.find(current_user.id)
    authorize @user
  end

  def update_password
    @user = ::Underworld::User.find(current_user.id)
    authorize @user
    respond_to do |f|
      if @user.update_with_password(resource_params)
        f.js { redirect_to new_user_session_path }
        f.html { redirect_to new_user_session_path }
      else
        @errors = @user.errors
        f.js {render :errors}
        f.html
      end
    end
  end

  def resource_params
    params.require(:user).permit(:password, :current_password, :password_confirmation, :first_name, :last_name, :email)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
underworld-1.0.0 app/controllers/underworld/dashboard/profile_controller.rb