]> git.mxchange.org Git - friendica.git/commitdiff
remove self
authorFriendika <info@friendika.com>
Thu, 3 Feb 2011 11:58:47 +0000 (03:58 -0800)
committerFriendika <info@friendika.com>
Thu, 3 Feb 2011 11:58:47 +0000 (03:58 -0800)
include/Contact.php
mod/removeme.php [new file with mode: 0644]
view/de/settings.tpl
view/en/settings.tpl
view/fr/settings.tpl
view/it/settings.tpl
view/removeme.tpl [new file with mode: 0644]

index 98d3e7c0b1083a40b15ff6802f7724c5ce37d2cd..7cac3c0e0ca9a3b555b1569a1bb05d0461ddc418 100644 (file)
@@ -6,6 +6,10 @@
 // authorisation to do this.
 
 function user_remove($uid) {
+       if(! $uid)
+               return;
+       $a = get_app();
+       logger('Removing user: ' . $uid);
        q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid));
        q("DELETE FROM `group` WHERE `uid` = %d", intval($uid));
        q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid));
@@ -19,7 +23,7 @@ function user_remove($uid) {
        if($uid == local_user()) {
                unset($_SESSION['authenticated']);
                unset($_SESSION['uid']);
-               killme();
+               goaway($a->get_baseurl());
        }
 }
 
diff --git a/mod/removeme.php b/mod/removeme.php
new file mode 100644 (file)
index 0000000..62b9a6d
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+function removeme_post(&$a) {
+
+       if(! local_user())
+               return;
+
+       if((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password']))))
+               return;
+
+       if((! x($_POST,'verify')) || (! strlen(trim($_POST['verify']))))
+               return;
+
+       if($_POST['verify'] !== $_SESSION['remove_account_verify'])
+               return;
+
+       $encrypted = hash('whirlpool',trim($_POST['qxz_password']));
+
+       if((strlen($a->user['password'])) && ($encrypted === $a->user['password'])) {
+               require_once('include/Contact.php');
+               user_remove($a->user['uid']);
+               // NOTREACHED
+       }
+
+}
+
+
+
+function removeme_content(&$a) {
+
+       if(! local_user())
+               goaway($a->get_baseurl());
+
+       $hash = random_string();
+
+       $_SESSION['remove_account_verify'] = $hash;
+
+       $tpl = load_view_file('view/removeme.tpl');
+       $o .= replace_macros($tpl, array(
+               '$basedir' => $a->get_baseurl(),
+               '$hash' => $hash,
+               '$title' => t('Remove My Account'),
+               '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'),
+               '$passwd' => t('Please enter your password for verification:'),
+               '$submit' => t('Remove My Account')
+       ));
+
+       return $o;              
+
+}
\ No newline at end of file
index 6259c171a2a8139e9d59e60482cc3aa69aab45f6..0ef50546f457c28397d5b554218ff74cc1fd98ac 100644 (file)
@@ -5,7 +5,7 @@
 $nickname_block
 
 
-<form action="settings" id="settings-form" method="post" autocomplete="false" >
+<form action="settings" id="settings-form" method="post" autocomplete="off" >
 
 
 <h3 class="settings-heading">Grundeinstellungen</h3>
index 5e1bfabf4c1876dc159df31fc6c73973c7170366..97d67cbf61679d07f8303bc6df2f27e452560bbf 100644 (file)
@@ -5,7 +5,7 @@
 $nickname_block
 
 
-<form action="settings" id="settings-form" method="post" autocomplete="false" >
+<form action="settings" id="settings-form" method="post" autocomplete="off" >
 
 
 <h3 class="settings-heading">Basic Settings</h3>
index 5e1bfabf4c1876dc159df31fc6c73973c7170366..97d67cbf61679d07f8303bc6df2f27e452560bbf 100644 (file)
@@ -5,7 +5,7 @@
 $nickname_block
 
 
-<form action="settings" id="settings-form" method="post" autocomplete="false" >
+<form action="settings" id="settings-form" method="post" autocomplete="off" >
 
 
 <h3 class="settings-heading">Basic Settings</h3>
index 2ff259acc8904d516de53383b7c3f19493dd92cc..3b68923cf45ba470a53cf2eb4a7860b3f3716426 100644 (file)
@@ -6,7 +6,7 @@
 $nickname_block
 
 
-<form action="settings" id="settings-form" method="post" autocomplete="false" >
+<form action="settings" id="settings-form" method="post" autocomplete="off" >
 
 
 <h3 class="settings-heading">Impostazioni base</h3>
diff --git a/view/removeme.tpl b/view/removeme.tpl
new file mode 100644 (file)
index 0000000..a3ca8d4
--- /dev/null
@@ -0,0 +1,20 @@
+<h1>$title</h1>
+
+<div id="remove-account-wrapper">
+
+<div id="remove-account-desc">$desc</div>
+
+<form action="$basedir/removeme" autocomplete="off" method="post" >
+<input type="hidden" name="verify" value="$hash" />
+
+<div id="remove-account-pass-wrapper">
+<label id="remove-account-pass-label" for="remove-account-pass">$passwd</label>
+<input type="password" id="remove-account-pass" name="qxz_password" />
+</div>
+<div id="remove-account-pass-end"></div>
+
+<input type="submit" name="submit" value="$submit" />
+
+</form>
+</div>
+