Files
danbooru/app/controllers/maintenance/user/deletions_controller.rb
evazion aea3837f9a users: delete accounts with invalid names.
Add a fix script to delete all accounts with invalid usernames. Also
change it so the owner-level user can delete accounts belonging to other
users.

Users who have logged in in the last year and who have a valid email
address will be given a one week warning. After that all accounts with
invalid names will be deleted. Anyone who has visited the site in the
last 6 months will have already seen a warning page that their name must
be changed to keep using the site.
2022-09-19 05:09:44 -05:00

27 lines
730 B
Ruby

# frozen_string_literal: true
module Maintenance
module User
class DeletionsController < ApplicationController
respond_to :html, :json, :xml
def show
end
def destroy
deletion = UserDeletion.new(user: CurrentUser.user, deleter: CurrentUser.user, password: params.dig(:user, :password), request: request)
deletion.delete!
if deletion.errors.none?
session.delete(:user_id)
flash[:notice] = "Your account has been deactivated"
respond_with(deletion, location: posts_path)
else
flash[:notice] = deletion.errors.full_messages.join("; ")
redirect_to maintenance_user_deletion_path
end
end
end
end
end