Add function to handle cookie creation at login.
This commit is contained in:
parent
718af651da
commit
c908cb71fb
|
@ -1279,6 +1279,27 @@ function group_display_name($gname)
|
|||
return $gname;
|
||||
}
|
||||
|
||||
function set_user_logged_in_cookies($name, $keys) {
|
||||
$name = trim($name);
|
||||
$auth_expire = 14400;
|
||||
$authkey = password_hash($name . $keys[0] . get_user_config($name, 'encryptionkey'), PASSWORD_DEFAULT);
|
||||
$pkey = hash('crc32', get_user_config($name, 'encryptionkey'));
|
||||
set_user_config(strtolower($name), "pkey", $pkey);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if (navigator.cookieEnabled)
|
||||
var authcookie = "<?php echo $authkey; ?>";
|
||||
var savename = "<?php echo stripslashes($name); ?>";
|
||||
var auth_expire = "<?php echo $auth_expire; ?>";
|
||||
var name_expire = "7776000";
|
||||
var pkey = "<?php echo $pkey; ?>";
|
||||
document.cookie = "mail_auth="+authcookie+"; max-age="+auth_expire+"; path=/";
|
||||
document.cookie = "mail_name="+savename+"; max-age="+name_expire+"; path=/";
|
||||
document.cookie = "pkey="+pkey+"; max-age="+name_expire+"; path=/";
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
function check_bbs_auth($username, $password)
|
||||
{
|
||||
global $config_dir, $spooldir, $CONFIG;
|
||||
|
|
Loading…
Reference in New Issue