Sha256: 4d05ba1d26fadfd208041b594b6d6dacbdb3f546c89147b85dc595486f0de866

Contents?: true

Size: 782 Bytes

Versions: 8

Compression:

Stored size: 782 Bytes

Contents

class ProfileController < ApplicationController
  skip_ensure_email_is_verified

  def edit
    render inertia: 'Profile/Edit', props: {
      mustVerifyEmail: User.include?(MustVerifyEmail),
      status: flash[:status]
    }
  end

  def update
    form = UpdateProfileInformationForm.new(params.permit(:name, :email))

    return redirect_to profile_edit_path, inertia: { errors: form.error_messages } if form.invalid?

    form.update

    redirect_to profile_edit_path
  end

  def destroy
    form = DeleteUserForm.new(params.permit(:password))

    return redirect_back_or_to profile_edit_path, inertia: { errors: form.error_messages } if form.invalid?

    user = Current.auth.user

    Current.auth.logout

    user.delete

    reset_session

    redirect_to '/'
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kaze-0.17.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.16.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.15.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.14.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.13.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.12.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.11.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.10.0 stubs/inertia-common/app/controllers/profile_controller.rb