diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-08-02 21:49:24 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-08-02 21:49:24 +0200 |
commit | 836a17626793ab95d666c62e9c21b3df2568eeb4 (patch) | |
tree | 7dd5a3d938ebe2774637482f420b95070d59e725 /inc/auth.php | |
parent | 20284fef7eb61e54db0fd854a9172295aa4f8baa (diff) | |
parent | 0f3dc5ebb0dc3386758834bd6646b46a514dfeff (diff) | |
download | rpg-836a17626793ab95d666c62e9c21b3df2568eeb4.tar.gz rpg-836a17626793ab95d666c62e9c21b3df2568eeb4.tar.bz2 |
Merge branch 'FS#2751' of git://github.com/splitbrain/dokuwiki into pull-request-245
* 'FS#2751' of git://github.com/splitbrain/dokuwiki:
coding corrections. correct type hint, remove unused variable assignment
de/de-informal: localization updates (delete user function)
unit tests for self deleting of user accounts
FS#2751 - self deletion of user account
Diffstat (limited to 'inc/auth.php')
-rw-r--r-- | inc/auth.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/inc/auth.php b/inc/auth.php index a1c92ec80..be6b7ebbe 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -1042,6 +1042,45 @@ function updateprofile() { return false; } +function auth_deleteprofile(){ + global $conf; + global $lang; + /* @var DokuWiki_Auth_Plugin $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($auth->triggerUserMod('delete', array($deleted))) { + // force and immediate logout including removing the sticky cookie + auth_logoff(); + return true; + } + + return false; +} + /** * Send a new password * |