summaryrefslogtreecommitdiff
path: root/inc/auth.php
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2013-07-31 18:14:26 +0200
committerChristopher Smith <chris@jalakai.co.uk>2013-07-31 18:14:26 +0200
commit2a7abf2d7fee6a2d6418e5ad4b79e37e6049bd92 (patch)
treeb4d8b38bd7113d0e02b7eb7a53da0d3b5354712b /inc/auth.php
parent07ff0babae240ba072a3bc8b83a989c4305c24cd (diff)
downloadrpg-2a7abf2d7fee6a2d6418e5ad4b79e37e6049bd92.tar.gz
rpg-2a7abf2d7fee6a2d6418e5ad4b79e37e6049bd92.tar.bz2
FS#2751 - self deletion of user account
Diffstat (limited to 'inc/auth.php')
-rw-r--r--inc/auth.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 537d44c01..75ba9a9ba 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -901,6 +901,45 @@ function updateprofile() {
return false;
}
+function auth_deleteprofile(){
+ global $conf;
+ global $lang;
+ /* @var auth_basic $auth */
+ global $auth;
+ /* @var Input $INPUT */
+ global $INPUT;
+
+ if(!$INPUT->post->bool('delete')) return false;
+ if(!checkSecurityToken()) return false;
+
+ // action prevented or auth module disallows
+ if(!actionOK('profile_delete') || !$auth->canDo('delUser')) {
+ msg($lang['profnodelete'], -1);
+ return false;
+ }
+
+ if(!$INPUT->post->bool('confirm_delete')){
+ msg($lang['profconfdeletemissing'], -1);
+ return false;
+ }
+
+ if($conf['profileconfirm']) {
+ if(!$auth->checkPass($_SERVER['REMOTE_USER'], $INPUT->post->str('oldpass'))) {
+ msg($lang['badpassconfirm'], -1);
+ return false;
+ }
+ }
+
+ $deleted[] = $_SERVER['REMOTE_USER'];
+ if($result = $auth->triggerUserMod('delete', array($deleted))) {
+ // force and immediate logout including removing the sticky cookie
+ auth_logoff();
+ return true;
+ }
+
+ return false;
+}
+
/**
* Send a new password
*