mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-23 08:43:19 +01:00
Force URI (re)generation at TwoFAccount model saving
This commit is contained in:
parent
0f53e6f93e
commit
657b9288da
@ -71,6 +71,10 @@ protected static function boot()
|
|||||||
static::retrieved(function ($model) {
|
static::retrieved(function ($model) {
|
||||||
$model->populateFromUri();
|
$model->populateFromUri();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static::saving(function ($model) {
|
||||||
|
$model->refreshUri();
|
||||||
|
});
|
||||||
|
|
||||||
static::deleted(function ($model) {
|
static::deleted(function ($model) {
|
||||||
Storage::delete('public/icons/' . $model->icon);
|
Storage::delete('public/icons/' . $model->icon);
|
||||||
@ -334,9 +338,6 @@ public function populate(Array $attrib = [])
|
|||||||
if (array_key_exists('imageLink', $attrib) && $attrib['imageLink'])
|
if (array_key_exists('imageLink', $attrib) && $attrib['imageLink'])
|
||||||
{ $this->otp->setParameter( 'image', $attrib['imageLink'] ); }
|
{ $this->otp->setParameter( 'image', $attrib['imageLink'] ); }
|
||||||
|
|
||||||
// We can now generate a fresh URI
|
|
||||||
$this->uri = $this->otp->getProvisioningUri();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (\Exception $e) {
|
catch (\Exception $e) {
|
||||||
throw \Illuminate\Validation\ValidationException::withMessages([
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
Loading…
Reference in New Issue
Block a user