Skip to content

Commit 2739671

Browse files
committed
Merge branch 'develop'
2 parents d097a9c + 767f31c commit 2739671

File tree

4 files changed

+49
-24
lines changed

4 files changed

+49
-24
lines changed

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,15 @@ No user found for the given e-mail adresse.
187187

188188
### Error View
189189

190-
Create a view for the default verification error route `/verification/error` at
191-
`resources/views/errors/user-verification.blade.php`. If an error occurs, the
192-
user will be redirected to this route and this view will be rendered. **You
193-
must implement and customize this view to your needs.** For instance you may
194-
wish to display a short message saying that something went wrong and then ask
195-
for the user's e-mail again and start the process from scratch (generate, send,
196-
verify, ...).
190+
By default the `user-verification.blade.php` view will be loaded for the verification error route `/verification/error`. If an error occurs, the user will be redirected to this route and this view will be rendered.
191+
192+
**You may customize this view to your needs.** To do so first publish the view to your resources folder:
193+
194+
```
195+
php artisan vendor:publish --tag=laravel-user-verification-views
196+
```
197+
198+
The view will be available in the `resources/views/vendor/laravel-user-verification/` directory and can be customized.
197199

198200
## Usage
199201

@@ -294,10 +296,6 @@ Where to redirect after a failling token verification.
294296

295297
* `$verificationErrorView = 'errors.user-verification';`
296298

297-
Name of the view returned by the getVerificationError method.
298-
299-
* `$verificationEmailView = 'emails.user-verification';`
300-
301299
Name of the default e-mail view.
302300

303301
* `$userTable = 'users';`
@@ -346,8 +344,6 @@ Edit the `app\Http\Controllers\Auth\RegisterController.php` file.
346344
- [ ] Overwrite and customize the redirect attributes/properties paths
347345
available within the `RedirectsUsers` trait included by the
348346
`VerifiesUsers` trait. (not mandatory)
349-
- [ ] Overwrite the default error view name used by the `getVerificationError()` method
350-
(not mandatory)
351347
- [x] Create the verification error view at
352348
`resources/views/errors/user-verification.blade.php` (mandatory)
353349
- [ ] Overwrite the contructor (not mandatory)

src/Traits/VerifiesUsers.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getVerification(Request $request, $token)
4747
*/
4848
public function getVerificationError()
4949
{
50-
return view($this->verificationErrorView());
50+
return view('laravel-user-verification::user-verification');
5151
}
5252

5353
/**
@@ -67,16 +67,6 @@ protected function validateRequest(Request $request)
6767
}
6868
}
6969

70-
/**
71-
* Get the verification error view name.
72-
*
73-
* @return string
74-
*/
75-
protected function verificationErrorView()
76-
{
77-
return property_exists($this, 'verificationErrorView') ? $this->verificationErrorView : 'errors.user-verification';
78-
}
79-
8070
/**
8171
* Get the verification e-mail view name.
8272
*

src/UserVerificationServiceProvider.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111

1212
class UserVerificationServiceProvider extends ServiceProvider
1313
{
14+
/**
15+
* Perform post-registration booting of services.
16+
*
17+
* @return void
18+
*/
19+
public function boot()
20+
{
21+
$this->loadViewsFrom(__DIR__.'/resources/views', 'laravel-user-verification');
22+
23+
$this->publishes([
24+
__DIR__.'/resources/views' => resource_path('views/vendor/laravel-user-verification'),
25+
], 'laravel-user-verification-views');
26+
}
1427
/**
1528
* Register the service provider.
1629
*
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@extends('layouts.app')
2+
3+
<!-- Main Content -->
4+
@section('content')
5+
<div class="container">
6+
<div class="row">
7+
<div class="col-md-8 col-md-offset-2">
8+
<div class="panel panel-default">
9+
<div class="panel-heading">Verification failed</div>
10+
<div class="panel-body">
11+
<span class="help-block">
12+
<strong>Your account could not be verified.</strong>
13+
</span>
14+
<div class="form-group">
15+
<div class="col-md-12">
16+
<a href="{{url('/')}}" class="btn btn-primary">
17+
Back
18+
</a>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
</div>
24+
</div>
25+
</div>
26+
@endsection

0 commit comments

Comments
 (0)