From de76ce685a8bb37a4fc7daa621b496a3bbae3878 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 17 Dec 2011 16:21:41 -0500 Subject: preventing an openid user from setting password --- start.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/start.php b/start.php index afe12ae92..a1defd280 100644 --- a/start.php +++ b/start.php @@ -26,7 +26,8 @@ function openid_client_init() { elgg_register_event_handler('create', 'user', 'openid_client_set_subtype', 1); - //elgg_register_page_handler('openid_client', 'openid_client_page_handler'); + // don't let OpenID users set their passwords + elgg_register_event_handler('pagesetup', 'system', 'openid_client_remove_email'); } /** @@ -83,21 +84,11 @@ function openid_client_setup_menu($hook, $type, $menu, $params) { } /** - * OpenID client page handler - * - * @param type $page Array of URL segments - * @return bool + * Remove the password view from the account settings form */ -function openid_client_page_handler($page) { - - // this is test code for right now - elgg_load_library('openid_client'); - openid_client_registration_page_handler(array( - 'username' => 'john', - 'email' => 'john@example.org', - 'name' => 'John Doe', - 'openid_identifier' => 'abcdefghijklmnopqrstuvwxyz', - )); - - return true; +function openid_client_remove_email() { + $page_owner = elgg_get_page_owner_entity(); + if ($page_owner && elgg_instanceof($page_owner, 'user', 'openid')) { + elgg_unextend_view('forms/account/settings', 'core/settings/account/password'); + } } -- cgit v1.2.3