blob: 1f26686202223dbe60f660f92040f87037137832 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
// This used to be an action, but as it is sent in an email message
// with unknown response time, it cannot have an action time stamp
// and so is now just a page
require_once(dirname(dirname(__FILE__)).'/models/model.php');
set_context('openid');
$code = get_input('code');
if (empty($code)) {
register_error(elgg_echo("openid_client:missing_confirmation_code"));
} elseif ($code{0} == 'a') {
// request to activate an account
if (!$details = openid_client_get_invitation($code)) {
register_error(elgg_echo("openid_client:invalid_code_error"));
} else {
// OK, everything seems to be in order, so activate this user
$user = get_user($details->new_owner);
$user->email = $details->email;
$user->name = $details->name;
$user->active = 'yes';
$user->save();
system_message(sprintf(elgg_echo("openid_client:account_created"), $details->username));
openid_client_remove_invitation($code);
}
} elseif ($code{0} == 'c') {
// request to change an email address
if (!$details = openid_client_get_invitation($code)) {
register_error(elgg_echo("openid_client:invalid_code_error"));
} else {
// OK, everything seems to be in order, so change the email address
$user = get_user($details->new_owner);
$user->email = $details->email;
$user->save();
system_message(sprintf(elgg_echo('openid_client:email_changed'),$details->email));
openid_client_remove_invitation($code);
}
}
if(isset($body) && $body) {
page_draw(elgg_echo('openid_client:confirmation_title'),$body);
} else {
forward();
}
|