mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-23 22:01:49 +01:00
Complete exception handling
This commit is contained in:
parent
544e916d60
commit
67fa859b2a
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use OTPHP\HOTP;
|
use OTPHP\HOTP;
|
||||||
use OTPHP\Factory;
|
use OTPHP\Factory;
|
||||||
use App\Classes\Options;
|
use App\Classes\Options;
|
||||||
@ -10,7 +11,6 @@
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Facades\Crypt;
|
use Illuminate\Support\Facades\Crypt;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
|
||||||
|
|
||||||
class TwoFAccount extends Model implements Sortable
|
class TwoFAccount extends Model implements Sortable
|
||||||
{
|
{
|
||||||
@ -193,7 +193,7 @@ public function getUriAttribute($value)
|
|||||||
try {
|
try {
|
||||||
return Crypt::decryptString($value);
|
return Crypt::decryptString($value);
|
||||||
}
|
}
|
||||||
catch (DecryptException $e) {
|
catch (Exception $e) {
|
||||||
return '*encrypted*';
|
return '*encrypted*';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ public function getAccountAttribute($value)
|
|||||||
try {
|
try {
|
||||||
return Crypt::decryptString($value);
|
return Crypt::decryptString($value);
|
||||||
}
|
}
|
||||||
catch (DecryptException $e) {
|
catch (Exception $e) {
|
||||||
return '*encrypted*';
|
return '*encrypted*';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,6 +136,9 @@
|
|||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getHOTP: function() {
|
getHOTP: function() {
|
||||||
@ -148,6 +151,9 @@
|
|||||||
this.next_uri = response.data.nextUri
|
this.next_uri = response.data.nextUri
|
||||||
|
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
clearOTP: function() {
|
clearOTP: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user