diff options
author | Yorhel <git@yorhel.nl> | 2019-10-14 15:15:46 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-10-14 16:27:07 +0200 |
commit | b539ea56c2406a110ca6666e9f42c3b4af8e1a10 (patch) | |
tree | 0da99d8f6d3a0134a44585ae05d041d764161c39 /lib | |
parent | 77f3a2933ea14bdec59354e40075b7faa3ff96ea (diff) |
Delete the user deletion feature
It's rather much code just to run a single SQL statement that I almost
never need. Incidentally, the feature was also broken because the DELETE
permission wasn't granted in perms.sql.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/DB/Users.pm | 9 | ||||
-rw-r--r-- | lib/VNDB/Handler/Users.pm | 44 | ||||
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 6 | ||||
-rw-r--r-- | lib/VNWeb/HTML.pm | 1 |
4 files changed, 1 insertions, 59 deletions
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm index 276ce202..d80e6547 100644 --- a/lib/VNDB/DB/Users.pm +++ b/lib/VNDB/DB/Users.pm @@ -6,7 +6,7 @@ use warnings; use Exporter 'import'; our @EXPORT = qw| - dbUserGet dbUserDel + dbUserGet |; @@ -79,12 +79,5 @@ sub dbUserGet { return wantarray ? ($r, $np) : $r; } - - -# uid -sub dbUserDel { - $_[0]->dbExec(q|DELETE FROM users WHERE id = ?|, $_[1]); -} - 1; diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm index 933825e7..56a00d2a 100644 --- a/lib/VNDB/Handler/Users.pm +++ b/lib/VNDB/Handler/Users.pm @@ -13,7 +13,6 @@ use PWLookup; TUWF::register( qr{u([1-9]\d*)/posts} => \&posts, - qr{u([1-9]\d*)/del(/[od])?} => \&delete, qr{u/(all|[0a-z])} => \&list, ); @@ -71,49 +70,6 @@ sub posts { } -sub delete { - my($self, $uid, $act) = @_; - return $self->htmlDenied if ($self->authInfo->{id}) != 2; # Yeah, yorhel-only function - - # rarely used admin function, won't really need translating - - # confirm - if(!$act) { - my $code = $self->authGetCode("/u$uid/del/o"); - my $u = $self->dbUserGet(uid => $uid, what => 'hide_list')->[0]; - return $self->resNotFound if !$u->{id}; - $self->htmlHeader(title => 'Delete user', noindex => 1); - $self->htmlMainTabs('u', $u, 'del'); - div class => 'mainbox'; - div class => 'warning'; - h2 'Delete user'; - p; - lit qq|Are you sure you want to remove <a href="/u$uid">$u->{username}</a>'s account?<br /><br />| - .qq|<a href="/u$uid/del/o?formcode=$code">Yes, I'm not kidding!</a>|; - end; - end; - end; - $self->htmlFooter; - } - # delete - elsif($act eq '/o') { - return if !$self->authCheckCode; - $self->dbUserDel($uid); - $self->resRedirect("/u$uid/del/d", 'post'); - } - # done - elsif($act eq '/d') { - $self->htmlHeader(title => 'Delete user', noindex => 1); - div class => 'mainbox'; - div class => 'notice'; - p 'User deleted.'; - end; - end; - $self->htmlFooter; - } -} - - sub list { my($self, $char) = @_; diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 0a09655c..3d18bdf5 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -82,12 +82,6 @@ sub htmlMainTabs { end; } - if($type eq 'u' && ($self->authInfo->{id}||0) == 2) { - li $sel eq 'del' ? (class => 'tabselected') : (); - a href => "/$id/del", 'remove'; - end; - } - if($type eq 'v') { li $sel eq 'releases' ? (class => 'tabselected') : (); a href => "/$id/releases", 'releases'; diff --git a/lib/VNWeb/HTML.pm b/lib/VNWeb/HTML.pm index f61fc16c..08601252 100644 --- a/lib/VNWeb/HTML.pm +++ b/lib/VNWeb/HTML.pm @@ -322,7 +322,6 @@ sub _maintabs_ { t tagmod => "/$id/tagmod", 'modify tags' if $t eq 'v' && auth->permTag && !$o->{entry_hidden}; t copy => "/$id/copy", 'copy' if $t =~ /[rc]/ && can_edit $t, $o; t edit => "/$id/edit", 'edit' if can_edit $t, $o; - t del => "/$id/del", 'remove' if $t eq 'u' && auth && auth->uid == 2; t releases => "/$id/releases", 'releases' if $t eq 'v'; t rgraph => "/$id/rg", 'relations' |