Permalink
Browse files

fix(register): consistent forwarding upon login

Newly registered users that have been validated now are
forwarded to the same location as if they would with the login action
Caught login exceptions are now shown to the user.
On exception, user is forwarded back to the referrer instead of index.
  • Loading branch information...
hypeJunction committed Sep 29, 2016
1 parent 57b9d7a commit a62410dd5b00e4dfc02d725c1fd777c87c73b186
Showing with 15 additions and 1 deletion.
  1. +15 −1 actions/register.php
View
@@ -63,8 +63,22 @@
// plugin that has disabled the user
try {
login($new_user);
// set forward url
$session = elgg_get_session();
if ($session->has('last_forward_from')) {
$forward_url = $session->get('last_forward_from');
$forward_source = 'last_forward_from';
} else {
// forward to main index page
$forward_url = '';
$forward_source = null;
}
$params = array('user' => $new_user, 'source' => $forward_source);
$forward_url = elgg_trigger_plugin_hook('login:forward', 'user', $params, $forward_url);
forward($forward_url);
} catch (LoginException $e) {
// do nothing
register_error($e->getMessage());
forward(REFERER);
}
}

0 comments on commit a62410d

Please sign in to comment.