User Preferences'; echo '
'; if ($_SESSION['userlevel'] == 11) { demo_account(); } else { if ($_POST['action'] == 'changepass') { if (authenticate($_SESSION['username'], $_POST['old_pass'])) { if ($_POST['new_pass'] == '' || $_POST['new_pass2'] == '') { $changepass_message = 'Password must not be blank.'; } elseif ($_POST['new_pass'] == $_POST['new_pass2']) { changepassword($_SESSION['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"; } } include 'includes/update-preferences-password.inc.php'; if (passwordscanchange($_SESSION['username'])) { echo '

Change Password

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

"; echo '
'; }//end if if ($config['twofactor'] === true) { if ($_POST['twofactorremove'] == 1) { include_once $config['install_dir'].'/html/includes/authentication/twofactor.lib.php'; if (!isset($_POST['twofactor'])) { echo '
'; echo ''; echo twofactor_form(false); echo '
'; } else { $twofactor = get_user_pref('twofactor'); if (empty($twofactor)) { echo '
Error: How did you even get here?!
'; } if (verify_hotp($twofactor['key'], $_POST['twofactor'], $twofactor['counter'])) { if (!set_user_pref('twofactor', array())) { echo '
Error while disabling TwoFactor.
'; } else { echo '
TwoFactor Disabled.
'; } } else { session_destroy(); echo '
Error: Supplied TwoFactor Token is wrong, you\'ve been logged out.
'; } }//end if } else { $twofactor = get_user_pref('twofactor'); echo ''; echo '

Two-Factor Authentication

'; if (!empty($twofactor)) { $twofactor['text'] = "
"; if ($twofactor['counter'] !== false) { $twofactor['uri'] = 'otpauth://hotp/'.$_SESSION['username'].'?issuer=LibreNMS&counter='.$twofactor['counter'].'&secret='.$twofactor['key']; $twofactor['text'] .= "
"; } else { $twofactor['uri'] = 'otpauth://totp/'.$_SESSION['username'].'?issuer=LibreNMS&secret='.$twofactor['key']; } echo '
'; echo '
'.$twofactor['text'].'
'; echo ''; echo '
'; } else { if (isset($_POST['gentwofactorkey']) && isset($_POST['twofactortype'])) { include_once $config['install_dir'].'/html/includes/authentication/twofactor.lib.php'; $chk = get_user_pref('twofactor'); if (empty($chk)) { $twofactor = array('key' => twofactor_genkey()); if ($_POST['twofactortype'] == 'counter') { $twofactor['counter'] = 1; } else { $twofactor['counter'] = false; } if (!set_user_pref('twofactor', $twofactor)) { echo '
Error inserting TwoFactor details. Please try again later and contact Administrator if error persists.
'; } else { echo '
Added TwoFactor credentials. Please reload page.
'; } } else { echo '
TwoFactor credentials already exists.
'; } } else { echo '
'; }//end if }//end if echo '
'; }//end if }//end if }//end if echo "

Default Dashboard


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

"; echo "

Device Permissions

"; echo "
"; echo "
"; if ($_SESSION['userlevel'] == '10') { echo "Global Administrative Access"; } if ($_SESSION['userlevel'] == '5') { echo "Global Viewing Access"; } if ($_SESSION['userlevel'] == '1') { foreach (dbFetchRows('SELECT * FROM `devices_perms` AS P, `devices` AS D WHERE `user_id` = ? AND P.device_id = D.device_id', array($_SESSION['user_id'])) as $perm) { // FIXME generatedevicelink? echo "".$perm['hostname'].'
'; $dev_access = 1; } if (!$dev_access) { echo 'No access!'; } } echo '
';