Adding feture request 604526: making it possible to disallow user from deactivating their account
This commit is contained in:
parent
49afc7e7fc
commit
1c84701e0d
3 changed files with 9 additions and 5 deletions
|
|
@ -52,8 +52,9 @@ sub _accountOptions {
|
|||
WebGUI::International::get(343).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=viewMessageLog').'">'.WebGUI::International::get(354).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=logout').'">'.WebGUI::International::get(64).'</a>';
|
||||
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=deactivateAccount').'">'.
|
||||
WebGUI::International::get(65).'</a>';
|
||||
WebGUI::International::get(65).'</a>' if ($session{setting}{selfDeactivation});
|
||||
$output .= '</ul></div>';
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -241,13 +242,15 @@ sub www_deactivateAccount {
|
|||
$output = www_displayLogin();
|
||||
} elsif ($session{user}{userId} < 26) {
|
||||
$output = WebGUI::Privilege::vitalComponent();
|
||||
} else {
|
||||
} elsif ($session{setting}{selfDeactivation}) {
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(60).'<p>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deactivateAccountConfirm').'">'.
|
||||
WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(45).'</a></div>';
|
||||
}
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +259,7 @@ sub www_deactivateAccountConfirm {
|
|||
my ($u);
|
||||
if ($session{user}{userId} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif ($session{user}{userId} != 1) {
|
||||
} elsif (($session{user}{userId} != 1) and $session{setting}{selfDeactivation}) {
|
||||
$u = WebGUI::User->new($session{user}{userId});
|
||||
$u->delete;
|
||||
WebGUI::Session::end($session{var}{sessionId});
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ sub www_editUserSettings {
|
|||
$f->interval("sessionTimeout",WebGUI::International::get(142),WebGUI::DateTime::secondsToInterval($session{setting}{sessionTimeout}));
|
||||
$f->select("authMethod",\%authMethod,WebGUI::International::get(119),[$session{setting}{authMethod}]);
|
||||
$f->yesNo("usernameBinding",WebGUI::International::get(306),$session{setting}{usernameBinding});
|
||||
$f->yesNo("selfDeactivation","Allow users to deactivate their account",$session{setting}{selfDeactivation});
|
||||
|
||||
foreach (@{$session{authentication}{available}}) {
|
||||
$cmd = "WebGUI::Authentication::".$_."::formEditUserSettings";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue