aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-01 15:49:55 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-01 15:49:55 +0000
commit9d7eed52f3e283d288b377a163ec479038bc2106 (patch)
treecc70c7c6e39946f081792cc86d06b90e10e32023 /actions
parente42a0edfbecd0a6d754366cc9d59aa2c80fcc140 (diff)
downloadelgg-9d7eed52f3e283d288b377a163ec479038bc2106.tar.gz
elgg-9d7eed52f3e283d288b377a163ec479038bc2106.tar.bz2
Refs #191: Actions for resetting passwords, but no front end as yet.
To request a password reset access http://..../actions/user/requestnewpassword/?username=username git-svn-id: https://code.elgg.org/elgg/trunk@1656 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions')
-rw-r--r--actions/user/passwordreset.php27
-rw-r--r--actions/user/requestnewpassword.php31
2 files changed, 58 insertions, 0 deletions
diff --git a/actions/user/passwordreset.php b/actions/user/passwordreset.php
new file mode 100644
index 000000000..677bc591d
--- /dev/null
+++ b/actions/user/passwordreset.php
@@ -0,0 +1,27 @@
+<?php
+ /**
+ * Action to reset a password and send success email.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ global $CONFIG;
+
+ $user_guid = get_input('u');
+ $code = get_input('c');
+
+ if (execute_new_password_request($user_guid, $code))
+ system_message(elgg_echo('user:password:success'));
+ else
+ register_error(elgg_echo('user:password:fail'));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+
+?> \ No newline at end of file
diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php
new file mode 100644
index 000000000..4f1fe7e83
--- /dev/null
+++ b/actions/user/requestnewpassword.php
@@ -0,0 +1,31 @@
+<?php
+ /**
+ * Action to request a new password.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ global $CONFIG;
+
+ $username = get_input('username');
+
+ $user = get_user_by_username($username);
+ if ($user)
+ {
+ if (send_new_password_request($user->guid))
+ system_message(elgg_echo('user:password:resetreq:success'));
+ else
+ register_error(elgg_echo('user:password:resetreq:fail'));
+ }
+ else
+ register_error(sprintf(elgg_echo('user:username:notfound'), $username));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+?> \ No newline at end of file