function bakery_uncrumble_submit in Bakery Single Sign-On System 7.2
Same name and namespace in other branches
- 6.2 bakery.module \bakery_uncrumble_submit()
- 6 bakery.module \bakery_uncrumble_submit()
Submit handler for 'bakery_uncrumble' form.
File
- ./
bakery.module, line 1920 - Module file for the Bakery.
Code
function bakery_uncrumble_submit($form, &$form_state) {
$account = $form_state['bakery_uncrumble_account'];
unset($form_state['bakery_uncrumble_account']);
$cookie = _bakery_validate_cookie();
db_update('users')
->fields(array(
'init' => $cookie['init'],
))
->condition('uid', $account->uid, '=')
->execute();
watchdog('bakery', 'uncrumble changed init field for uid %uid from %oldinit to %newinit', array(
'%oldinit' => $account->init,
'%newinit' => $cookie['init'],
'%uid' => $account->uid,
));
user_save($account, array(
'name' => $cookie['name'],
'mail' => $cookie['mail'],
));
watchdog('bakery', 'uncrumble updated name %name_old to %name_new, mail %mail_old to %mail_new on uid %uid.', array(
'%name_old' => $account->name,
'%name_new' => $cookie['name'],
'%mail_old' => $account->mail,
'%mail_new' => $cookie['mail'],
'%uid' => $account->uid,
));
drupal_set_message(t('Your account has been repaired.'));
$form_state['redirect'] = 'user';
}