[SECURITY] Enforce Strong Password Policy di Seluruh Fitur (Change/Reset/Registration)#979
Merged
vickyrolanda merged 6 commits intorilis-devfrom Mar 30, 2026
Merged
[SECURITY] Enforce Strong Password Policy di Seluruh Fitur (Change/Reset/Registration)#979vickyrolanda merged 6 commits intorilis-devfrom
vickyrolanda merged 6 commits intorilis-devfrom
Conversation
…set/Registration)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Perbaikan issue #963
Password Policy Implementation
Ringkasan
Implementasi password policy yang kuat untuk meningkatkan keamanan aplikasi dengan fitur:
Fitur
1. StrongPassword Rule (
app/Rules/StrongPassword.php)Validasi password dengan kriteria:
2. Password History (
app/Models/PasswordHistory.php)Menyimpan riwayat password user untuk:
3. Password Expiry
CheckPasswordExpirymenangani redirect otomatis4. Force Password Reset
Konfigurasi
File konfigurasi:
config/password.phpPenggunaan
Registration
Password baru saat registrasi otomatis divalidasi dengan
StrongPasswordrule:Change Password
User yang ingin ganti password harus memenuhi kriteria strong password:
Reset Password
Reset password via email juga menggunakan validasi yang sama:
Audit Script
Jalankan audit untuk mendeteksi user dengan password lemah:
Script akan:
Middleware
CheckPasswordExpiry
Middleware ini memastikan user dengan password expired atau force_reset flag akan diarahkan ke halaman reset password.
Tambahkan ke route group:
Model Methods (User)
Testing
Jalankan test untuk validasi password rule:
php artisan test --filter StrongPasswordRuleTestTest mencakup:
Database Schema
password_histories table
users table (added columns)
Error Messages
Validasi password menyediakan pesan error yang jelas:
File yang Dibuat/Dimodifikasi
Baru
app/Rules/StrongPassword.phpapp/Models/PasswordHistory.phpapp/Http/Requests/RegisterRequest.phpapp/Http/Requests/ChangePasswordRequest.phpapp/Http/Requests/ResetPasswordRequest.phpapp/Http/Requests/ForcePasswordResetRequest.phpapp/Http/Controllers/ForcePasswordResetController.phpapp/Http/Middleware/CheckPasswordExpiry.phpapp/Console/Commands/AuditWeakPasswords.phpconfig/password.phpresources/views/auth/force-password-reset.blade.phpdatabase/migrations/2026_03_11_000001_create_password_histories_table.phpdatabase/migrations/2026_03_11_091131_add_password_expires_at_to_users_table.phptests/Feature/StrongPasswordRuleTest.phpDimodifikasi
app/Models/User.php- Added relationships and password methodsapp/Http/Kernel.php- Registered password.expiry middlewareroutes/web.php- Added force password reset routesapp/Http/Controllers/Auth/RegisterController.php- Use FormRequestapp/Http/Controllers/Auth/ChangePasswordController.php- Use FormRequest, password historyapp/Http/Controllers/Auth/ResetPasswordController.php- Use FormRequest, password historyLangkah Penyelesaian
Setelah Perbaikan
simplescreenrecorder-2026-03-11_11.35.19.mp4