summaryrefslogtreecommitdiff
path: root/inc/auth.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-08-02 21:52:50 +0200
committerAndreas Gohr <andi@splitbrain.org>2013-08-02 21:52:50 +0200
commit395e7d8e1e303ae87be5d88abc67947b89e1a5a4 (patch)
tree4e91abd30543ca241c8528ab75d6a2264c43d151 /inc/auth.php
parent5b230a45afb9bb825ba148e699bdcbfc57957fb4 (diff)
parent836a17626793ab95d666c62e9c21b3df2568eeb4 (diff)
downloadrpg-395e7d8e1e303ae87be5d88abc67947b89e1a5a4.tar.gz
rpg-395e7d8e1e303ae87be5d88abc67947b89e1a5a4.tar.bz2
Merge branch 'pull-request-245'
* pull-request-245: coding corrections. correct type hint, remove unused variable assignment HTTPClient don't pull too much bytes when no content-length is given de/de-informal: localization updates (delete user function) unit tests for self deleting of user accounts FS#2751 - self deletion of user account Conflicts: inc/lang/de-informal/lang.php inc/lang/de/lang.php
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 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
*