1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-26 17:56:48 +00:00

Merge pull request #3099 from pixelfed/staging

Update RegisterController
This commit is contained in:
daniel 2021-12-29 00:51:40 -07:00 committed by GitHub
commit 2df960ac7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View file

@ -44,6 +44,13 @@ class RegisterController extends Controller
$this->middleware('guest');
}
public function getRegisterToken()
{
return \Cache::remember('pf:register:rt', 900, function() {
return str_random(40);
});
}
/**
* Get a validator for an incoming registration request.
*
@ -110,8 +117,18 @@ class RegisterController extends Controller
},
];
$rt = [
'required',
function ($attribute, $value, $fail) {
if($value !== $this->getRegisterToken()) {
return $fail('Something went wrong');
}
}
];
$rules = [
'agecheck' => 'required|accepted',
'rt' => $rt,
'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'),
'username' => $usernameRules,
'email' => $emailRules,

BIN
public/css/spa.css vendored

Binary file not shown.

Binary file not shown.

View file

@ -10,7 +10,7 @@
<div class="card-body">
<form method="POST" action="{{ route('register') }}" class="px-md-3">
@csrf
<input type="hidden" name="rt" value="{{ (new \App\Http\Controllers\Auth\RegisterController())->getRegisterToken() }}">
<div class="form-group row">
<div class="col-md-12">
<label class="small font-weight-bold text-lighter">Name</label>