This repository has been archived by the owner on Sep 12, 2022. It is now read-only.
forked from DarkGhostHunter/Larapass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recover.blade.php
60 lines (54 loc) · 2.18 KB
/
recover.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@extends('larapass::layout')
@section('title', trans('larapass::recovery.title'))
@section('body')
<form id="form">
<input type="hidden" name="email" value="{{ $email }}">
<input type="hidden" name="token" value="{{ $token }}">
<h2 class="card-title h5 text-center">{{ trans('larapass::recovery.title') }}</h2>
<hr>
<p>{{ trans('larapass::recovery.instructions') }}</p>
@if ($errors->any())
<div class="alert alert-danger small">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-group text-center">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="unique">
<label class="custom-control-label" for="unique">{{ trans('larapass::recovery.unique') }}</label>
</div>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg">
{{ trans('larapass::recovery.button.register') }}
</button>
</div>
</form>
@endsection
@push('scripts')
<script src="{{ asset('vendor/larapass/js/larapass.js') }}"></script>
<script>
const larapass = new Larapass({
register: '/webauthn/recover/register',
registerOptions: '/webauthn/recover/options'
})
document.getElementById('form').addEventListener('submit', function (event) {
event.preventDefault()
let entries = Object.fromEntries(new FormData(this).entries())
larapass.register(entries, {
token: entries.token,
email: entries.email,
'WebAuthn-Unique': entries.unique ? true : false,
})
.then(response => window.location.replace(response.redirectTo))
.catch(response => {
alert('{{ trans('larapass::recovery.failed') }}')
console.error('Recovery failed', response)
})
})
</script>
@endpush