diff options
Diffstat (limited to 'actions/openid_client/register.php')
-rw-r--r-- | actions/openid_client/register.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/actions/openid_client/register.php b/actions/openid_client/register.php new file mode 100644 index 000000000..e847d2395 --- /dev/null +++ b/actions/openid_client/register.php @@ -0,0 +1,34 @@ +<?php +/** + * Register an OpenID user + */ + +elgg_set_context('openid_client'); + +$username = get_input('username'); +$name = get_input('name'); +$email = get_input('email'); +$openid_identifier = get_input('openid_identifier'); + +$password = 'test'; + +try { + $guid = register_user($username, $password, $name, $email, false); +} catch (RegistrationException $e) { + register_error($e->getMessage()); + forward(REFERER); +} +$user = get_entity($guid); + +$user->openid_identifier = $openid_identifier; +elgg_set_user_validation_status($guid, true, 'openid'); + +if (!elgg_trigger_plugin_hook('register', 'user', array('user' => $user), true)) { + $user->delete(); + register_error(elgg_echo('registerbad')); + forward(REFERER); +} + +login($user); +system_message($message); +forward(); |