WIP: Road to 1.0.0 #1
@ -24,6 +24,7 @@ namespace App\Http\Controllers\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Profile;
|
||||
use App\User;
|
||||
use App\Facades\Options;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
@ -81,11 +82,30 @@ class RegisterController extends Controller
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
$password = ['required', 'string', 'confirmed'];
|
||||
|
||||
switch (Options::getOption('pw_security_policy'))
|
||||
{ // this could be better structured, switch doesn't feel right
|
||||
case 'off':
|
||||
$password = ['required', 'string', 'confirmed'];
|
||||
break;
|
||||
case 'low':
|
||||
$password = ['required', 'string', 'min:10', 'confirmed'];
|
||||
break;
|
||||
|
||||
case 'medium':
|
||||
$password = ['required', 'string', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[#?!@$%^&*-]).{10,}$/'];
|
||||
break;
|
||||
|
||||
case 'high':
|
||||
$password = ['required', 'string', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{20,}$/']
|
||||
}
|
||||
|
||||
return Validator::make($data, [
|
||||
'uuid' => ['required', 'string', 'unique:users', 'min:32', 'max:32'],
|
||||
'uuid' => (Options::getOption('requireGameLicense') && Options::getOption('currentGame') == 'MINECRAFT') ? ['required', 'string', 'unique:users', 'min:32', 'max:32'] : ['nullable', 'string'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:10', 'confirmed', 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%]).*$/'],
|
||||
'password' => $password,
|
||||
], [
|
||||
'uuid.required' => 'Please enter a valid (and Premium) Minecraft username! We do not support cracked users.',
|
||||
]);
|
||||
|
@ -58,7 +58,6 @@
|
||||
<p><b>Low:</b> Good choice for low-traffic websites, e.g. community with less than 100 members.</p>
|
||||
<ul>
|
||||
<li>Minimum 10 characters</li>
|
||||
<li>Must contain special characters</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col">
|
||||
@ -67,7 +66,6 @@
|
||||
<li>Minimum 12 characters</li>
|
||||
<li>Must contain special characters</li>
|
||||
<li>Must contain upper and lower case characters</li>
|
||||
<li>Can't be the user's name/e-mail</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
Loading…
Reference in New Issue
Block a user