Add password strength requirment

This commit adds a password strength requirement for new users using 
regular expressions.
Also adds a dismissable alert so users know how to create passwords 
properly.
This commit is contained in:
Miguel Nogueira 2020-07-17 23:13:46 +01:00
parent d392c0593f
commit 2763f777ab
2 changed files with 22 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class RegisterController extends Controller
'uuid' => ['required', 'string', 'unique:users', 'min:32', 'max:32'], 'uuid' => ['required', 'string', 'unique:users', 'min:32', 'max:32'],
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'], 'password' => ['required', 'string', 'min:6', 'confirmed', 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%]).*$/'],
], [ ], [
'uuid.required' => 'Please enter a valid (and Premium) Minecraft username! We do not support cracked users.' 'uuid.required' => 'Please enter a valid (and Premium) Minecraft username! We do not support cracked users.'
]); ]);

View File

@ -14,6 +14,27 @@
<img src="{{ config('adminlte.logo_img') }}" alt="logo" class="logo">{{ config('adminlte.logo') }} <img src="{{ config('adminlte.logo_img') }}" alt="logo" class="logo">{{ config('adminlte.logo') }}
</div> </div>
<p class="login-card-description">Register a new account</p> <p class="login-card-description">Register a new account</p>
<div class="alert alert-warning alert-dismissible">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<p><b>Basic password security</b></p>
<p>For your security, we implement strict password policies. It's also advisable to let your password manager or browser generate and save passwords for you (if it's a private device).</p>
<p>Passwords must be a combination of: </p>
<ul>
<li>
A minimum of 6 characters;
</li>
<li>
At least 3 uppercase characters;
</li>
<li>
At least 3 numbers;
</li>
<li>
Any number of special characters.
</li>
</ul>
</div>
<form action="{{ route('register') }}" method="POST" id="registerForm"> <form action="{{ route('register') }}" method="POST" id="registerForm">
@csrf @csrf
<div class="form-group"> <div class="form-group">