Fix FLEXIAPI-166 Reimplement the deprecated email validation URL

This commit is contained in:
Timothée Jaussoin 2024-04-25 11:03:18 +02:00
parent 911862870c
commit fd57132d06
3 changed files with 27 additions and 0 deletions

View file

@ -2,6 +2,7 @@
v1.5
----
- Fix FLEXIAPI-166 Reimplement the deprecated email validation URL
- Fix FLEXIAPI-165 Remove for now text/vcard header constraint
- Fix FLEXIAPI-164 Add vcards-storage endpoints
- Fix FLEXIAPI-162 Drop the aliases table and migrate the data to the phone column

View file

@ -74,6 +74,29 @@ class AuthenticateController extends Controller
return redirect()->back()->withErrors(['authentication' => 'Wrong username or password']);
}
/**
* Deprecated
*/
public function validateEmail(Request $request, string $code)
{
$request->merge(['code' => $code]);
$request->validate(['code' => 'required|size:' . self::$emailCodeSize]);
$account = Account::where('confirmation_key', $code)->first();
if (!$account) {
return redirect()->route('account.login');
}
$account->confirmation_key = null;
$account->activated = true;
$account->save();
Auth::login($account);
return redirect()->route('dashboard');
}
public function loginAuthToken(Request $request, ?string $token = null)
{
$authToken = null;

View file

@ -50,6 +50,9 @@ Route::group(['middleware' => 'web_panel_enabled'], function () {
Route::post('authenticate', 'Account\AuthenticateController@authenticate')->name('account.authenticate');
Route::get('authenticate/qrcode/{token?}', 'Account\AuthenticateController@loginAuthToken')->name('account.authenticate.auth_token');
// Deprecated
Route::get('authenticate/email/{code}', 'Account\AuthenticateController@validateEmail')->name('account.authenticate.email_confirm');
Route::prefix('creation_token')->controller(CreationRequestTokenController::class)->group(function () {
Route::get('check/{token}', 'check')->name('account.creation_request_token.check');
Route::post('validate', 'validateToken')->name('account.creation_request_token.validate');