Better bad QR code handling in create form

This commit is contained in:
Bubka
2020-01-09 20:33:31 +01:00
parent 102d98863b
commit 543f6b89db
2 changed files with 20 additions and 18 deletions

View File

@ -42,22 +42,12 @@ class QrCodecontroller extends Controller
// delete uploaded file
Storage::delete($path);
if( empty($uri) ) {
return response()->json([
'error' => [
'qrcode' => 'Nothing readable in this QR code 😕'
]
], 400);
}
// Check uri validity
if( !TimedTOTP::get($uri) ) {
return response()->json([
'error' => [
'uri' => 'This uri do not return any TOTP code 😕'
'qrcode' => 'No valid TOTP resource in this QR code'
]
], 400);