Add session key setup

This commit is contained in:
Marcus Hill 2022-01-10 21:47:12 +00:00
parent 00be27f8f4
commit 13d83f6e3b
1 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,11 @@ if(isset($_POST['login'])){
$user_name = $row['user_name'];
$user_id = $row['user_id'];
//Setup encryption session key
$user_encryption_ciphertext = $row['user_specific_encryption_ciphertext'];
$site_encryption_master_key = decryptUserSpecificKey($user_encryption_ciphertext, $password);
generateUserSessionKey($site_encryption_master_key);
if(empty($token)){
$_SESSION['logged'] = TRUE;
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login', log_action = 'Success', log_description = '$user_name successfully logged in', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_user_id = $user_id");