aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-06-11 15:56:11 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-06-11 15:56:11 +0000
commit0e39eac3459d2ff698b51e87a469a2790e510a19 (patch)
tree65caa36ace7d782bba36137aa4a78912c68ae367 /engine
parentd720eac96fda5415f4becf64d6ba49716aa14f6c (diff)
downloadelgg-0e39eac3459d2ff698b51e87a469a2790e510a19.tar.gz
elgg-0e39eac3459d2ff698b51e87a469a2790e510a19.tar.bz2
Fixes #3515 created a unified page handler for account pages
git-svn-id: http://code.elgg.org/elgg/trunk@9175 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggSite.php2
-rw-r--r--engine/lib/users.php60
2 files changed, 21 insertions, 41 deletions
diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php
index d3cb0d488..30b222c24 100644
--- a/engine/classes/ElggSite.php
+++ b/engine/classes/ElggSite.php
@@ -400,7 +400,7 @@ class ElggSite extends ElggEntity {
'action/login',
'register',
'action/register',
- 'pages/account/forgotten_password\.php',
+ 'forgotpassword',
'action/user/requestnewpassword',
'resetpassword',
'upgrade\.php',
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 832bcd529..8333888a2 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -748,40 +748,6 @@ function execute_new_password_request($user_guid, $conf_code) {
}
/**
- * Handles pages for password reset requests.
- *
- * @param array $page Pages array
- *
- * @return void
- */
-function elgg_user_resetpassword_page_handler($page) {
-
- $user_guid = get_input('u');
- $code = get_input('c');
-
- $user = get_entity($user_guid);
-
- // don't check code here to avoid automated attacks
- if (!$user instanceof ElggUser) {
- register_error(elgg_echo('user:passwordreset:unknown_user'));
- forward();
- }
-
- $params = array(
- 'guid' => $user_guid,
- 'code' => $code,
- );
- $form = elgg_view_form('user/passwordreset', array(), $params);
-
- $title = elgg_echo('resetpassword');
- $content = elgg_view_title(elgg_echo('resetpassword')) . $form;
-
- $body = elgg_view_layout('one_column', array('content' => $content));
-
- echo elgg_view_page($title, $body);
-}
-
-/**
* Simple function that will generate a random clear text password
* suitable for feeding into generate_user_password().
*
@@ -1129,14 +1095,27 @@ function collections_page_handler($page_elements) {
}
/**
- * Page handler for registration
+ * Page handler for account related pages
*
- * @param array $page_elements Page elements
+ * @param array $page_elements Page elements
+ * @param string $handler The handler string
*
* @return void
*/
-function registration_page_handler($page_elements) {
- require_once(dirname(dirname(dirname(__FILE__))) . "/pages/account/register.php");
+function elgg_user_account_page_handler($page_elements, $handler) {
+
+ $base_dir = elgg_get_root_path() . 'pages/account';
+ switch ($handler) {
+ case 'forgotpassword':
+ require_once("$base_dir/forgotten_password.php");
+ break;
+ case 'resetpassword':
+ require_once("$base_dir/reset_password.php");
+ break;
+ case 'register':
+ require_once("$base_dir/register.php");
+ break;
+ }
}
/**
@@ -1513,8 +1492,9 @@ function users_init() {
elgg_register_page_handler('friends', 'friends_page_handler');
elgg_register_page_handler('friendsof', 'friends_of_page_handler');
- elgg_register_page_handler('register', 'registration_page_handler');
- elgg_register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler');
+ elgg_register_page_handler('register', 'elgg_user_account_page_handler');
+ elgg_register_page_handler('forgotpassword', 'elgg_user_account_page_handler');
+ elgg_register_page_handler('resetpassword', 'elgg_user_account_page_handler');
elgg_register_page_handler('login', 'elgg_user_login_page_handler');
elgg_register_page_handler('avatar', 'elgg_avatar_page_handler');
elgg_register_page_handler('profile', 'elgg_profile_page_handler');