mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-02 19:49:24 +01:00
Fix #110 - Reset WebAuthn user options after last device revocation
This commit is contained in:
parent
caf72a6c9f
commit
fbb85342c1
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Facades\Settings;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Requests\WebauthnRenameRequest;
|
use App\Http\Requests\WebauthnRenameRequest;
|
||||||
@ -72,6 +73,13 @@ public function delete(Request $request, $credential)
|
|||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
$user->removeCredential($credential);
|
$user->removeCredential($credential);
|
||||||
|
|
||||||
|
// Webauthn user options should be reset to prevent impossible login
|
||||||
|
// See #110
|
||||||
|
if (blank($user->allCredentialDescriptors())) {
|
||||||
|
Settings::delete('useWebauthnAsDefault');
|
||||||
|
Settings::delete('useWebauthnOnly');
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json(null, 204);
|
return response()->json(null, 204);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -180,6 +180,14 @@
|
|||||||
await this.axios.delete('/webauthn/credentials/' + credentialId).then(response => {
|
await this.axios.delete('/webauthn/credentials/' + credentialId).then(response => {
|
||||||
// Remove the revoked credential from the collection
|
// Remove the revoked credential from the collection
|
||||||
this.credentials = this.credentials.filter(a => a.id !== credentialId)
|
this.credentials = this.credentials.filter(a => a.id !== credentialId)
|
||||||
|
|
||||||
|
if (this.credentials.length == 0) {
|
||||||
|
this.form.useWebauthnOnly = false
|
||||||
|
this.form.useWebauthnAsDefault = false
|
||||||
|
this.$root.appSettings['useWebauthnOnly'] = false
|
||||||
|
this.$root.appSettings['useWebauthnAsDefault'] = false
|
||||||
|
}
|
||||||
|
|
||||||
this.$notify({ type: 'is-success', text: this.$t('auth.webauthn.device_revoked') })
|
this.$notify({ type: 'is-success', text: this.$t('auth.webauthn.device_revoked') })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user