Update iar

This commit is contained in:
Daniel Supernault 2022-12-02 05:29:26 -07:00
parent 76961c4119
commit 59e818cbbd
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 14 additions and 3 deletions

View file

@ -475,8 +475,6 @@ class ApiV1Dot1Controller extends Controller
}, },
], ],
'password' => 'required|string|min:8', 'password' => 'required|string|min:8',
// 'avatar' => 'required|mimetypes:image/jpeg,image/png|max:15000',
// 'bio' => 'required|max:140'
]); ]);
$email = $request->input('email'); $email = $request->input('email');
@ -507,7 +505,7 @@ class ApiV1Dot1Controller extends Controller
$verify->random_token = $rtoken; $verify->random_token = $rtoken;
$verify->save(); $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)); 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) public function inAppRegistrationConfirm(Request $request)
{ {
abort_if($request->user(), 404); 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::get('iarpfc', 'Api\ApiV1Dot1Controller@inAppRegistrationPreFlightCheck');
Route::post('iar', 'Api\ApiV1Dot1Controller@inAppRegistration'); Route::post('iar', 'Api\ApiV1Dot1Controller@inAppRegistration');
Route::post('iarc', 'Api\ApiV1Dot1Controller@inAppRegistrationConfirm'); Route::post('iarc', 'Api\ApiV1Dot1Controller@inAppRegistrationConfirm');
Route::get('iarer', 'Api\ApiV1Dot1Controller@inAppRegistrationEmailRedirect');
}); });
}); });