1
0
Fork 0
forked from mirror/pixelfed

Merge pull request #3881 from pixelfed/staging

Update iar
This commit is contained in:
daniel 2022-12-02 05:30:22 -07:00 committed by GitHub
commit 1b211edc34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -475,8 +475,6 @@ class ApiV1Dot1Controller extends Controller
},
],
'password' => 'required|string|min:8',
// 'avatar' => 'required|mimetypes:image/jpeg,image/png|max:15000',
// 'bio' => 'required|max:140'
]);
$email = $request->input('email');
@ -507,7 +505,7 @@ class ApiV1Dot1Controller extends Controller
$verify->random_token = $rtoken;
$verify->save();
$appUrl = 'pixelfed://confirm-account/'. $user->app_register_token . '?rt=' . $rtoken;
$appUrl = url('/api/v1.1/auth/iarer?ut=' . $user->app_register_token . '&rt=' . $rtoken);
Mail::to($user->email)->send(new ConfirmAppEmail($verify, $appUrl));
@ -516,6 +514,18 @@ class ApiV1Dot1Controller extends Controller
]);
}
public function inAppRegistrationEmailRedirect(Request $request)
{
$this->validate($request, [
'ut' => 'required',
'rt' => 'required'
]);
$ut = $request->input('ut');
$rt = $request->input('rt');
$url = 'pixelfed://confirm-account/'. $ut . '?rt=' . $rt;
return redirect()->away($url);
}
public function inAppRegistrationConfirm(Request $request)
{
abort_if($request->user(), 404);

View file

@ -154,6 +154,7 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
Route::get('iarpfc', 'Api\ApiV1Dot1Controller@inAppRegistrationPreFlightCheck');
Route::post('iar', 'Api\ApiV1Dot1Controller@inAppRegistration');
Route::post('iarc', 'Api\ApiV1Dot1Controller@inAppRegistrationConfirm');
Route::get('iarer', 'Api\ApiV1Dot1Controller@inAppRegistrationEmailRedirect');
});
});