forked from External/greenlight
add option in settings to delete account
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UsersController < ApplicationController
|
||||
before_action :find_user, only: [:edit, :update]
|
||||
before_action :find_user, only: [:edit, :update, :destroy]
|
||||
before_action :ensure_unauthenticated, only: [:new, :create]
|
||||
|
||||
# POST /u
|
||||
@ -72,6 +72,15 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /u/:user_uid
|
||||
def destroy
|
||||
if current_user && current_user == @user
|
||||
@user.destroy
|
||||
session.delete(:user_id)
|
||||
end
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
# GET /u/terms
|
||||
def terms
|
||||
redirect_to root_path unless current_user
|
||||
|
Reference in New Issue
Block a user