Fakultas Ilmu Komputer UI

Commit 28594ab2 authored by Muhammad Indra Ramadhan's avatar Muhammad Indra Ramadhan
Browse files

Give password to user

parent d7f87789
......@@ -62,7 +62,7 @@ function generateRandomString($length = 10) {
$user = SSO\SSO::getUser();
$conn = new PDO('pgsql:host='.$server.';dbname=adminer', $username, $password);
$query = $conn->prepare("SELECT * FROM public.mahasiswas WHERE user_id = ?;");
$query = $conn->prepare("SELECT * FROM public.mahasiswas WHERE user_id = ?;");
$query->execute([$user->username]);
$result = $query->fetchAll();
$pgsql_username = str_replace(".", "_", $user->username);
......
......@@ -24,6 +24,12 @@ function connect_error() {
}
echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>$connection->extension</b>") . "\n";
echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
// -- BEGIN (OPEN SAUCE) --
global $pgsql_password;
echo "<p> Password: <span id='psqlpassword' style='display:none;'>$pgsql_password</span><span id='sensor'>*****</span> <button id='togglePassword'>show</button> </p>";
// -- END (OPEN SAUCE) --
$databases = $adminer->databases();
if ($databases) {
$scheme = support("scheme");
......
......@@ -911,3 +911,19 @@ oninput = function (event) {
var maxLength = target.getAttribute('data-maxlength');
alterClass(target, 'maxlength', target.value && maxLength != null && target.value.length > maxLength); // maxLength could be 0
};
// -- BEGIN (OPEN SAUCE) --
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById("togglePassword").addEventListener("click", function() {
if (document.getElementById("psqlpassword").style.display === "none") {
document.getElementById("psqlpassword").style.display = "initial";
document.getElementById("sensor").style.display = "none";
document.getElementById("togglePassword").innerHTML = "hide";
} else {
document.getElementById("psqlpassword").style.display = "none";
document.getElementById("sensor").style.display = "initial";
document.getElementById("togglePassword").innerHTML = "show";
}
});
})
// -- END (OPEN SAUCE) --
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment