Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove DELETE.time stuff when deleting user; check for a user_delete_…

…user_callback; update account delete and password update to check for rsp hash instead of a boolean
  • Loading branch information...
commit b422e03a63e881584fb7df99e1b0b90fd4bf8e83 1 parent 75ecbe9
straup authored
4 account_delete.php
View
@@ -24,9 +24,9 @@
if (post_str('confirm')){
- $ok = users_delete_user($GLOBALS['cfg']['user']);
+ $rsp = users_delete_user($GLOBALS['cfg']['user']);
- if ($ok){
+ if ($rsp['ok']){
login_do_logout();
$smarty->display('page_account_delete_done.txt');
5 account_password.php
View
@@ -48,7 +48,10 @@
}
if ($ok){
- if (!users_update_password($GLOBALS['cfg']['user'], $new_pass1)){
+
+ $rsp = users_update_password($GLOBALS['cfg']['user'], $new_pass1);
+
+ if (! $rsp['ok']){
$smarty->assign('error_fail', 1);
$ok = 0;
25 include/lib_users.php
View
@@ -93,16 +93,35 @@ function users_update_password(&$user, $new_password){
function users_delete_user(&$user){
- $now = time();
+ # rely on mysql to enforce a unique key
+ # on (email, deleted)
- $new_email = "{$user['email']}.DELETED.{$now}";
+ $new_email = "{$user['email']}.DELETED";
- return users_update_user($user, array(
+ $rsp = users_update_user($user, array(
'deleted' => time(),
'email' => AddSlashes($new_email),
# reset the password here ?
));
+
+ if (! $rsp['ok']){
+ return $rsp;
+ }
+
+ #
+ # check to see if the application (outside of
+ # flamework) has defined a callback function
+ # to run once the user has been 'deleted' in
+ # the database.
+ #
+
+ if (function_exists('users_delete_user_callback')){
+ users_reload_user($user);
+ $rsp['callback'] = users_delete_user_callback($user);
+ }
+
+ return $rsp;
}
#################################################################
Please sign in to comment.
Something went wrong with that request. Please try again.