add option in settings to delete account

This commit is contained in:
Joshua Arts
2018-07-27 11:36:28 -04:00
parent f285377abf
commit 5e5f31c375
7 changed files with 75 additions and 1 deletions

View File

@ -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