function bakery_bake_oatmeal_cookie in Bakery Single Sign-On System 6
Same name and namespace in other branches
- 6.2 bakery.module \bakery_bake_oatmeal_cookie()
- 7.2 bakery.module \bakery_bake_oatmeal_cookie()
Create a new cookie for redirection after login
1 string reference to 'bakery_bake_oatmeal_cookie'
- bakery_menu in ./
bakery.module - Implementation of hook_menu().
File
- ./
bakery.module, line 543
Code
function bakery_bake_oatmeal_cookie() {
$key = variable_get('bakery_key', '');
if (!empty($key)) {
global $base_url;
$cookie = array();
$cookie['name'] = 'login';
$cookie['mail'] = 'no_mail';
$destination = drupal_get_destination();
$destination = substr($destination, strpos($destination, '=') + 1);
$destination = $destination == 'bakery' ? '' : urldecode($destination);
$cookie['destination'] = $base_url . '/' . $destination;
$cookie['calories'] = 320;
$cookie['timestamp'] = $_SERVER['REQUEST_TIME'];
$cookie['signature'] = hash_hmac('sha256', $cookie['name'] . '/' . $cookie['mail'] . '/' . $cookie['timestamp'], $key);
setcookie('OATMEAL', bakery_mix(serialize($cookie), 1), $_SERVER['REQUEST_TIME'] + variable_get('bakery_freshness', '3600'), '/', variable_get('bakery_domain', ''));
}
unset($_REQUEST['destination']);
drupal_goto(trim(variable_get('bakery_master', 'http://drupal.org/'), '/') . '/user/login');
}