function hybridauth_email_confirm in HybridAuth Social Login 7
Menu callback; confirm email for HybridAuth registrations that require it.
See also
1 string reference to 'hybridauth_email_confirm'
- hybridauth_menu in ./
hybridauth.module - Implements hook_menu().
File
- ./
hybridauth.pages.inc, line 555
Code
function hybridauth_email_confirm($uid, $timestamp, $hashed_pass) {
global $user;
// Make sure that a user isn't already logged in.
if ($user->uid) {
// The user is already logged in
if ($user->uid == $uid) {
drupal_set_message(t('You have already used this email confirmation link and you are already logged in.'));
drupal_goto();
}
else {
$reset_link_account = user_load($uid);
if (!empty($reset_link_account)) {
drupal_set_message(t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href="!logout">logout</a> and try using the link again.', array(
'%other_user' => $user->name,
'%resetting_user' => $reset_link_account->name,
'!logout' => url('user/logout'),
)));
}
else {
// Invalid one-time link specifies an unknown user.
drupal_set_message(t('The one-time login link you clicked is invalid.'));
}
}
drupal_goto();
}
else {
$user = user_load_multiple(array(
$uid,
), array(
'status' => 1,
));
if ($account = array_shift($user)) {
if ($account->login) {
drupal_set_message(t('Your email address has already been confirmed and you may login at any time.'));
drupal_goto('user');
}
elseif ($hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
// Load global $user and perform final login tasks.
$form_state['uid'] = $account->uid;
user_login_submit(array(), $form_state);
drupal_set_message(t('Thank you for confirming your email address.'));
drupal_goto('user/' . $user->uid . '/edit');
}
}
}
// If all else fails, deny access.
drupal_access_denied();
}