aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/admin.php34
-rw-r--r--actions/login.php4
-rw-r--r--actions/missing.php54
-rw-r--r--actions/openid_client/login.php2
-rw-r--r--actions/openid_client/register.php6
-rw-r--r--actions/sync.php57
6 files changed, 4 insertions, 153 deletions
diff --git a/actions/admin.php b/actions/admin.php
deleted file mode 100644
index 568c852a5..000000000
--- a/actions/admin.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-// let admins configure the OpenID client
-
-require_once(dirname(dirname(__FILE__)).'/models/model.php');
-
-admin_gatekeeper();
-
-$always_sync = get_input('always_sync');
-$sso = get_input('sso','no');
-$default_server = trim(get_input('default_server'));
-$greenlist = trim(get_input('greenlist'));
-$yellowlist = trim(get_input('yellowlist'));
-$redlist = trim(get_input('redlist'));
-
-set_plugin_setting('default_server',$default_server,'openid_client');
-if ($always_sync) {
- set_plugin_setting('always_sync',$always_sync,'openid_client');
-} else {
- set_plugin_setting('always_sync','no','openid_client');
-}
-if ($sso) {
- set_plugin_setting('sso',$sso,'openid_client');
-} else {
- set_plugin_setting('sso','no','openid_client');
-}
-set_plugin_setting('greenlist',$greenlist,'openid_client');
-set_plugin_setting('yellowlist',$yellowlist,'openid_client');
-set_plugin_setting('redlist',$redlist,'openid_client');
-
-system_message(elgg_echo('openid_client:admin_response'));
-
-forward($CONFIG->wwwroot . "pg/openid_client/admin");
-
diff --git a/actions/login.php b/actions/login.php
deleted file mode 100644
index 44b8233fd..000000000
--- a/actions/login.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-require_once(dirname(dirname(__FILE__)).'/models/model.php');
-
-openid_client_handle_login();
diff --git a/actions/missing.php b/actions/missing.php
deleted file mode 100644
index f18bad65a..000000000
--- a/actions/missing.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-require_once(dirname(dirname(__FILE__)).'/models/model.php');
-
-global $CONFIG;
-set_context('openid');
-$code = get_input('openid_code');
-$name = trim(get_input('name'));
-$email = trim(get_input('email'));
-$error = false;
-if (!$name) {
- register_error(elgg_echo("openid_client:missing_name_error"));
- $error = true;
-}
-if (!$email || !validate_email_address($email)) {
- register_error(elgg_echo("openid_client:invalid_email_error"));
- $error = true;
-}
-
-if (empty($code) || !($details = openid_client_get_invitation($code))) {
- register_error(elgg_echo("openid_client:invalid_code_error"));
- $error = true;
-}
-
-if (!$error) {
- // looks good
-
- if ($code{0} == 'a') {
- // need to confirm first
- $details->email = $email;
- $details->name = $name;
- openid_client_send_activate_confirmation_message($details);
- system_message(sprintf(elgg_echo("openid_client:activate_confirmation"),$email));
- } elseif ($code{0} == 'n') {
- //activate and login
- $user = get_user($details->owner);
- $user->email = $email;
- $user->name = $name;
- $user->active = 'yes';
- $user->save();
- system_message(sprintf(elgg_echo("openid_client:created_openid_account"),$email, $name));
- login($user);
- }
- forward();
-} elseif ($details) {
- // regenerate the form
- $user = get_user($details->owner);
- $openid_url = $user->alias;
- $email_confirmation = openid_client_check_email_confirmation($openid_url);
- $body = openid_client_generate_missing_data_form($openid_url,$email,$fullname,$email_confirmation,$code);
- page_draw(elgg_echo('openid_client:information_title'),$body);
-} else {
- // bad code - not much to do but inform user
- forward();
-}
diff --git a/actions/openid_client/login.php b/actions/openid_client/login.php
index 5e7ad3ace..305ea3110 100644
--- a/actions/openid_client/login.php
+++ b/actions/openid_client/login.php
@@ -1,6 +1,6 @@
<?php
/**
- *
+ * OpenID client login action
*/
elgg_load_library('openid_consumer');
diff --git a/actions/openid_client/register.php b/actions/openid_client/register.php
index e847d2395..c4d3501ed 100644
--- a/actions/openid_client/register.php
+++ b/actions/openid_client/register.php
@@ -1,6 +1,6 @@
<?php
/**
- * Register an OpenID user
+ * Register OpenID user action
*/
elgg_set_context('openid_client');
@@ -10,7 +10,7 @@ $name = get_input('name');
$email = get_input('email');
$openid_identifier = get_input('openid_identifier');
-$password = 'test';
+$password = generate_random_cleartext_password();
try {
$guid = register_user($username, $password, $name, $email, false);
@@ -30,5 +30,5 @@ if (!elgg_trigger_plugin_hook('register', 'user', array('user' => $user), true))
}
login($user);
-system_message($message);
+system_message(elgg_echo('openid_client:success:register'));
forward();
diff --git a/actions/sync.php b/actions/sync.php
deleted file mode 100644
index 3f93df9df..000000000
--- a/actions/sync.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-require_once(dirname(dirname(__FILE__)).'/models/model.php');
-
-set_context('openid');
-global $CONFIG;
-
-if (isloggedin()) {
-
- $userid = get_loggedin_userid();
- $user = get_user($userid);
- $namechange = get_input('namechange');
- $emailchange = get_input('emailchange');
- $nosync = get_input('nosync');
-
- if ($namechange) {
- $name = get_input('new_name');
- $user->name = $name;
- system_message(sprintf(elgg_echo("openid_client:name_updated"),$name));
- }
-
- if ($emailchange) {
- $i_code = get_input('i_code');
- if (empty($i_code)) {
- $new_email = get_input('new_email');
- // this is an email address change request from a yellow OpenID, so the
- // email address change must be confirmed with an email message
- if (get_user_by_email($email)) {
- register_error(sprintf(elgg_echo("openid_client:email_in_use"),$email));
- } else {
- $details = openid_client_create_invitation('c',$user->username,$userid,$new_email,$user->name);
- openid_client_send_change_confirmation_message($details);
- system_message(sprintf(elgg_echo("openid_client:change_confirmation"), $email));
- }
- } elseif (!($details = openid_client_get_invitation($i_code))) {
- register_error(elgg_echo("openid_client:invalid_code_error"));
- } else {
- // this is an email address change request from a green OpenID, so the
- // email address change does not need to be confirmed
-
- $email = $details->email;
- $ident = $details->owner;
- if (get_user_by_email($email)) {
- register_error(sprintf(elgg_echo("openid_client:email_in_use"),$email));
- } else {
- $user->email;
- system_message(sprintf(elgg_echo("openid_client:email_updated"),$email));
- }
- }
- }
-
- if ($nosync) {
- $store = new OpenID_ElggStore();
- $store->addNoSyncStatus($user);
- }
-}
-
-forward();