User Preferences'; echo '
'; if (LegacyAuth::user()->isDemoUser()) { demo_account(); } else { if ($_POST['action'] == 'changepass') { if (LegacyAuth::get()->authenticate(['username' => LegacyAuth::user()->username, 'password' => $_POST['old_pass']])) { if ($_POST['new_pass'] == '' || $_POST['new_pass2'] == '') { $changepass_message = 'Password must not be blank.'; } elseif ($_POST['new_pass'] == $_POST['new_pass2']) { LegacyAuth::get()->changePassword(LegacyAuth::user()->username, $_POST['new_pass']); $changepass_message = 'Password Changed.'; } else { $changepass_message = "Passwords don't match."; } } else { $changepass_message = 'Incorrect password'; } } if ($vars['action'] === 'changedash') { if (!empty($vars['dashboard'])) { set_user_pref('dashboard', (int)$vars['dashboard']); $updatedashboard_message = "User default dashboard updated"; } } if ($vars['action'] === 'changenote') { set_user_pref('add_schedule_note_to_device', (bool)$vars['notetodevice']); if ($vars['notetodevice']) { $updatenote_message = "Schedule notes will now be added to device notes"; } else { $updatenote_message = "Schedule notes will no longer be added to device notes"; } } include 'includes/html/update-preferences-password.inc.php'; if (LegacyAuth::get()->canUpdatePasswords(LegacyAuth::user()->username)) { echo '

Change Password

'; echo '
'; echo "
"; echo $changepass_message; echo "

"; echo '
'; }//end if if ($config['twofactor'] === true) { $twofactor = get_user_pref('twofactor'); echo ''; echo '

Two-Factor Authentication

'; echo '
'; echo '
'; if (!empty($twofactor)) { $twofactor['text'] = "
"; if ($twofactor['counter'] !== false) { $twofactor['uri'] = 'otpauth://hotp/'.LegacyAuth::user()->username.'?issuer=LibreNMS&counter='.$twofactor['counter'].'&secret='.$twofactor['key']; $twofactor['text'] .= "
"; } else { $twofactor['uri'] = 'otpauth://totp/'.LegacyAuth::user()->username.'?issuer=LibreNMS&secret='.$twofactor['key']; } echo '
'; echo '
'.$twofactor['text'].'
'; echo ''; echo '
'; } else { echo '
'; }//end if echo '
'; }//end if }//end if echo "

Default Dashboard


"; if (!empty($updatedashboard_message)) { print_message($updatedashboard_message); } echo "
'; echo "

Add schedule notes to devices notes


"; if (!empty($updatenote_message)) { print_message($updatenote_message); } echo "
"; echo "

Device Permissions

"; echo "
"; echo '
'; if (LegacyAuth::user()->hasGlobalAdmin()) { echo "Global Administrative Access"; } elseif (LegacyAuth::user()->hasGlobalRead()) { echo "Global Viewing Access"; } else { foreach (dbFetchRows('SELECT * FROM `devices_perms` AS P, `devices` AS D WHERE `user_id` = ? AND P.device_id = D.device_id', array(LegacyAuth::id())) as $perm) { // FIXME generatedevicelink? echo "".$perm['hostname'].'
'; $dev_access = 1; } if (!$dev_access) { echo 'No access!'; } } echo '
'; echo "";