Mengubah password semua actor
This commit is contained in:
@@ -94,39 +94,29 @@ CREATE TABLE IF NOT EXISTS users (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
-- ── Akun Demo ─────────────────────────────────────────────
|
-- ── Akun Demo ─────────────────────────────────────────────
|
||||||
-- Password di-hash menggunakan bcrypt (PHP password_hash)
|
-- Password semua akun: "password" (bcrypt via PHP PASSWORD_DEFAULT)
|
||||||
-- admin → admin123
|
|
||||||
-- petugas → petugas123
|
|
||||||
-- pengurus → pengurus123
|
|
||||||
--
|
|
||||||
-- Hash ini sudah valid, digenerate dengan PASSWORD_DEFAULT PHP 8
|
|
||||||
INSERT INTO users (username, nama_lengkap, role, password_hash) VALUES
|
INSERT INTO users (username, nama_lengkap, role, password_hash) VALUES
|
||||||
(
|
(
|
||||||
'admin',
|
'admin',
|
||||||
'Administrator Sistem',
|
'Administrator Sistem',
|
||||||
'admin',
|
'admin',
|
||||||
'$2y$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'petugas',
|
'petugas',
|
||||||
'Petugas Lapangan',
|
'Petugas Lapangan',
|
||||||
'petugas',
|
'petugas',
|
||||||
'$2y$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'pengurus',
|
'pengurus',
|
||||||
'Pengurus Rumah Ibadah',
|
'Pengurus Rumah Ibadah',
|
||||||
'pengurus',
|
'pengurus',
|
||||||
'$2y$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'walikota',
|
'walikota',
|
||||||
'Walikota Pontianak',
|
'Walikota Pontianak',
|
||||||
'walikota',
|
'walikota',
|
||||||
'$2y$10$s0387VqXY8wBXYkVytEKxumpF0DmlBlE1z3usinr0nr1RYN/4BZw.'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
);
|
);
|
||||||
|
|
||||||
-- !! CATATAN: Hash di atas adalah placeholder "password".
|
|
||||||
-- Setelah import, jalankan generate_hash.php untuk meng-update
|
|
||||||
-- hash dengan password yang benar (admin123, petugas123, pengurus123).
|
|
||||||
-- URL: http://localhost/WebGIS/pertemuan fix/generate_hash.php
|
|
||||||
|
|||||||
@@ -7,11 +7,12 @@
|
|||||||
|
|
||||||
require_once 'config.php';
|
require_once 'config.php';
|
||||||
|
|
||||||
// Daftar akun demo yang akan di-insert / update
|
// Daftar akun demo yang akan di-insert / update (password seragam: "password")
|
||||||
$demoUsers = [
|
$demoUsers = [
|
||||||
['username' => 'admin', 'nama' => 'Administrator Sistem', 'role' => 'admin', 'password' => 'admin123'],
|
['username' => 'admin', 'nama' => 'Administrator Sistem', 'role' => 'admin', 'password' => 'password'],
|
||||||
['username' => 'pengurus', 'nama' => 'Pengurus Rumah Ibadah', 'role' => 'pengurus', 'password' => 'pengurus123'],
|
['username' => 'petugas', 'nama' => 'Petugas Lapangan', 'role' => 'petugas', 'password' => 'password'],
|
||||||
['username' => 'walikota', 'nama' => 'Walikota Pontianak', 'role' => 'walikota', 'password' => 'walikota123'],
|
['username' => 'pengurus', 'nama' => 'Pengurus Rumah Ibadah', 'role' => 'pengurus', 'password' => 'password'],
|
||||||
|
['username' => 'walikota', 'nama' => 'Walikota Pontianak', 'role' => 'walikota', 'password' => 'password'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$db = getDB();
|
$db = getDB();
|
||||||
@@ -79,7 +80,7 @@ header('Content-Type: text/html; charset=utf-8');
|
|||||||
<td class="<?= str_starts_with($r['status'],'✅') ? 'ok':'err' ?>"><?= $r['status'] ?></td>
|
<td class="<?= str_starts_with($r['status'],'✅') ? 'ok':'err' ?>"><?= $r['status'] ?></td>
|
||||||
<td><?= htmlspecialchars($r['username']) ?></td>
|
<td><?= htmlspecialchars($r['username']) ?></td>
|
||||||
<td><?= htmlspecialchars($r['role']) ?></td>
|
<td><?= htmlspecialchars($r['role']) ?></td>
|
||||||
<td><?= ($r['username'].'123') ?></td>
|
<td>password</td>
|
||||||
<td style="font-size:11px;word-break:break-all"><?= htmlspecialchars($r['hash']) ?></td>
|
<td style="font-size:11px;word-break:break-all"><?= htmlspecialchars($r['hash']) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
@@ -739,9 +739,9 @@
|
|||||||
<!-- Quick Fill -->
|
<!-- Quick Fill -->
|
||||||
<div class="quick-fill-label">Akun Demo — Klik untuk Isi Otomatis</div>
|
<div class="quick-fill-label">Akun Demo — Klik untuk Isi Otomatis</div>
|
||||||
<div class="quick-row">
|
<div class="quick-row">
|
||||||
<button class="quick-btn" onclick="isiDemo('admin','admin123','admin')">🛡️ Admin</button>
|
<button class="quick-btn" onclick="isiDemo('admin','password','admin')">🛡️ Admin</button>
|
||||||
<button class="quick-btn" onclick="isiDemo('pengurus','pengurus123','pengurus')">🕌 Pengurus</button>
|
<button class="quick-btn" onclick="isiDemo('pengurus','password','pengurus')">🕌 Pengurus</button>
|
||||||
<button class="quick-btn" onclick="isiDemo('walikota','walikota123','walikota')">👑 Walikota</button>
|
<button class="quick-btn" onclick="isiDemo('walikota','password','walikota')">👑 Walikota</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer-note">WebGIS Poverty Mapping · 2026</div>
|
<div class="footer-note">WebGIS Poverty Mapping · 2026</div>
|
||||||
|
|||||||
@@ -91,11 +91,5 @@ PREPARE stmt FROM @sql;
|
|||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
-- ── 6. Update password walikota (gunakan generate_hash.php untuk update bcrypt) ──
|
-- ── 6. Password semua akun: "password" ──
|
||||||
-- Password walikota: walikota123
|
-- Jalankan update_pass.php atau generate_hash.php jika database sudah ada.
|
||||||
-- Jalankan generate_hash.php setelah migrasi ini untuk update hash
|
|
||||||
|
|
||||||
-- ============================================================
|
|
||||||
-- SELESAI. Jalankan generate_hash.php untuk update password hash.
|
|
||||||
-- URL: http://localhost/WebGIS/pertemuan fix/generate_hash.php
|
|
||||||
-- ============================================================
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
// ============================================================
|
||||||
|
// update_pass.php – Set semua password user menjadi "password"
|
||||||
|
// Akses: http://localhost/WebGIS/WebGIS_PovertyMap/update_pass.php
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
require_once 'config.php';
|
||||||
|
|
||||||
|
// Nonaktifkan header JSON dari config.php untuk output HTML
|
||||||
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
|
||||||
|
$db = getDB();
|
||||||
|
$hash = password_hash('password', PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$stmt = $db->prepare('UPDATE users SET password_hash = ?');
|
||||||
|
$stmt->bind_param('s', $hash);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$count = $stmt->affected_rows;
|
||||||
|
echo "Berhasil: {$count} akun diupdate. Password semua user = \"password\"\n";
|
||||||
|
echo "Hash: {$hash}\n";
|
||||||
|
} else {
|
||||||
|
echo 'Error: ' . $stmt->error . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
$db->close();
|
||||||
@@ -20,48 +20,41 @@ CREATE TABLE IF NOT EXISTS users (
|
|||||||
INDEX idx_aktif (aktif)
|
INDEX idx_aktif (aktif)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
-- ── Akun demo (password di-hash dengan bcrypt PHP PASSWORD_DEFAULT) ──
|
-- ── Akun demo (password semua akun: "password") ──
|
||||||
-- Gunakan script generate_hash.php untuk membuat hash baru jika perlu.
|
-- Hash bcrypt digenerate dengan PHP password_hash('password', PASSWORD_DEFAULT)
|
||||||
--
|
--
|
||||||
-- admin → admin123
|
-- admin → password
|
||||||
-- petugas → petugas123
|
-- petugas → password
|
||||||
-- pengurus → pengurus123
|
-- pengurus → password
|
||||||
--
|
-- walikota → password
|
||||||
-- Hash di bawah digenerate dengan PHP:
|
|
||||||
-- password_hash('admin123', PASSWORD_DEFAULT) → $2y$12$...
|
|
||||||
-- password_hash('petugas123', PASSWORD_DEFAULT) → $2y$12$...
|
|
||||||
-- password_hash('pengurus123', PASSWORD_DEFAULT) → $2y$12$...
|
|
||||||
--
|
|
||||||
-- !! Jangan gunakan plain text password di produksi !!
|
|
||||||
|
|
||||||
INSERT INTO users (username, nama_lengkap, role, password_hash) VALUES
|
INSERT INTO users (username, nama_lengkap, role, password_hash) VALUES
|
||||||
(
|
(
|
||||||
'admin',
|
'admin',
|
||||||
'Administrator Sistem',
|
'Administrator Sistem',
|
||||||
'admin',
|
'admin',
|
||||||
'$2y$12$YourHashHereReplaceMe.admin123HashGeneratedByPHP'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'petugas',
|
'petugas',
|
||||||
'Petugas Lapangan',
|
'Petugas Lapangan',
|
||||||
'petugas',
|
'petugas',
|
||||||
'$2y$12$YourHashHereReplaceMe.petugas123HashGeneratedByPHP'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'pengurus',
|
'pengurus',
|
||||||
'Pengurus Rumah Ibadah',
|
'Pengurus Rumah Ibadah',
|
||||||
'pengurus',
|
'pengurus',
|
||||||
'$2y$12$YourHashHereReplaceMe.pengurus123HashGeneratedByPHP'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'walikota',
|
'walikota',
|
||||||
'Walikota Pontianak',
|
'Walikota Pontianak',
|
||||||
'walikota',
|
'walikota',
|
||||||
'$2y$10$s0387VqXY8wBXYkVytEKxumpF0DmlBlE1z3usinr0nr1RYN/4BZw.'
|
'$2y$10$mhMxyKlOSSTQxfmWXEncfe1AF56CJ8fb.v0h0CYZ.ELQQd8iP5LrG'
|
||||||
);
|
);
|
||||||
|
|
||||||
-- !! PENTING: Setelah import tabel di atas, jalankan generate_hash.php
|
-- !! Untuk database yang sudah ada, jalankan update_pass.php atau generate_hash.php !!
|
||||||
-- untuk mengisi password_hash yang benar secara otomatis. !!
|
|
||||||
|
|
||||||
-- ── Catatan hak akses per role ──────────────────────────────
|
-- ── Catatan hak akses per role ──────────────────────────────
|
||||||
/*
|
/*
|
||||||
|
|||||||
+5
-5
@@ -54,7 +54,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<span class="tech-stack">Leaflet · PHP · MySQL</span>
|
<span class="tech-stack">Leaflet · PHP · MySQL</span>
|
||||||
<a href="WebGIS_SPBU/index.html" class="btn-primary">
|
<a href="./WebGIS_SPBU/index.html" class="btn-primary">
|
||||||
Buka Aplikasi
|
Buka Aplikasi
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
stroke-width="2.5">
|
stroke-width="2.5">
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<span class="tech-stack">Leaflet · PHP · MySQL</span>
|
<span class="tech-stack">Leaflet · PHP · MySQL</span>
|
||||||
<a href="Manajemen_Jalan_dan_Parsil/index.html" class="btn-primary">
|
<a href="./Manajemen_Jalan_dan_Parsil/index.html" class="btn-primary">
|
||||||
Buka Aplikasi
|
Buka Aplikasi
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
stroke-width="2.5">
|
stroke-width="2.5">
|
||||||
@@ -107,15 +107,15 @@
|
|||||||
<div class="card-footer card-footer-multi">
|
<div class="card-footer card-footer-multi">
|
||||||
<span class="tech-stack">Leaflet · PHP · MySQL · RBAC</span>
|
<span class="tech-stack">Leaflet · PHP · MySQL · RBAC</span>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="WebGIS_PovertyMap/login.html" class="btn-primary">
|
<a href="./WebGIS_PovertyMap/login.html" class="btn-primary">
|
||||||
Login
|
Login
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
stroke-width="2.5">
|
stroke-width="2.5">
|
||||||
<path d="M5 12h14M12 5l7 7-7 7" />
|
<path d="M5 12h14M12 5l7 7-7 7" />
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<a href="WebGIS_PovertyMap/index.html" class="btn-secondary">Peta Utama</a>
|
<a href="./WebGIS_PovertyMap/index.html" class="btn-secondary">Peta Utama</a>
|
||||||
<a href="WebGIS_PovertyMap/dashboard_walikota.html" class="btn-secondary">Dashboard</a>
|
<a href="./WebGIS_PovertyMap/dashboard_walikota.html" class="btn-secondary">Dashboard</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
Reference in New Issue
Block a user