You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Quickly add some password protection to a staging site.
10
+
#### Quickly add password protection to a staging site.
11
11
12
12
Shielding a staging or demo website from the public usually involves setting op authentication separate from the actual project. This isn't always easy or is cumbersome at the least.
13
13
@@ -17,31 +17,49 @@ By installing StageFront with composer, adding the middleware and setting 3 vari
17
17
18
18

19
19
20
-
## Requirements
20
+
## ✅ Requirements
21
21
22
-
- PHP >= 7.0
23
-
-[Laravel](https://laravel.com/) >= 5.5
22
+
- PHP >= 7.1
23
+
-[Laravel](https://laravel.com/) >= 5.6
24
24
25
-
## Installation
25
+
## 📦 Installation
26
26
27
-
Require the package via Composer:
27
+
#### ☑️ Require the package via Composer:
28
28
29
-
```
29
+
```bash
30
30
composer require codezero/laravel-stagefront
31
31
```
32
-
Add the middleware to the web middleware group, **right after the `StartSession` middleware** in `app/Http/Kernel.php`:
32
+
Laravel will automatically register the [ServiceProvider](https://github.com/codezero-be/laravel-stagefront/blob/master/src/StageFrontServiceProvider.php) and routes.
33
+
34
+
When StageFront is disabled, its routes will not be registered.
35
+
36
+
#### ☑️ Install Middleware
37
+
38
+
To activate the middleware, add it to the `web` middleware group in `app/Http/Kernel.php`, **right after the `StartSession` middleware**:
Laravel will automatically register the [ServiceProvider](https://github.com/codezero-be/laravel-stagefront/blob/master/src/StageFrontServiceProvider.php) and routes.
50
+
In Laravel 6+ you need to add the middleware to the `$middlewarePriority` array in `app/Http/Kernel.php`, **right after the `StartSession` middleware**.
39
51
40
-
When StageFront is disabled, its routes will not be registered.
52
+
```php
53
+
protected $middlewarePriority = [
54
+
\Illuminate\Session\Middleware\StartSession::class, // <= after this
Now you just need to set some `.env` variables and you are up and running!
43
61
44
-
## Quick Setup
62
+
## ⌨️ Quick Setup
45
63
46
64
Set some options in your `.env` file or publish the [configuration file](#publish-configuration-file).
47
65
@@ -62,7 +80,7 @@ If you set `STAGEFRONT_ENCRYPTED` to `true` the password should be a hashed valu
62
80
63
81
You can generate this using Laravel's `\Hash::make('your password')` function.
64
82
65
-
## Database Logins
83
+
## 👥 Database Logins
66
84
67
85
If you have existing users in the database and want to use those credentials, you can set `STAGEFRONT_DATABASE` to `true`. The above settings will then be ignored.
68
86
@@ -78,7 +96,9 @@ If you want to grant access to just a few of those users, you can whitelist them
78
96
79
97
By default the `users` table is used with the `email` and `password` field names. But you can change this if you are using some other table or fields.
80
98
81
-
## Change Route URL
99
+
## ⚙️ Other Options
100
+
101
+
#### ☑️ Change Route URL
82
102
83
103
By default a `GET` and `POST` route will be registered with the `/stagefront` URL.
84
104
@@ -92,7 +112,7 @@ It runs under the `web` middleware since it uses the session to keep you logged
92
112
93
113
You can change the middleware if needed in the [configuration file](#publish-configuration-file).
94
114
95
-
## Throttle Login Attempts
115
+
#### ☑️ Throttle Login Attempts
96
116
97
117
To prevent malicious users from brute forcing passwords, login attempts will be throttled unless you disable it. You can change the number of failed attempts per minute to allow, and the delay (in minutes) that users have to wait after reaching the maximum failed attempts.
98
118
@@ -122,7 +142,7 @@ Text in this view can be changed via the [translation files](#translations-and-v
If for any reason you wish to disable StageFront on specific routes, you can add these to the `ignore_urls` array in the [configuration file](#publish-configuration-file). You can use wildcards if needed. You can't set this in the `.env` file.
128
148
@@ -137,7 +157,7 @@ For example:
137
157
],
138
158
```
139
159
140
-
## Link Live Site
160
+
#### ☑️ Link Live Site
141
161
142
162
If you set the URL to your live site, a link will be shown underneath the login form.
143
163
@@ -147,52 +167,63 @@ If you set the URL to your live site, a link will be shown underneath the login
147
167
148
168
Make sure you enter the full URL, including `https://`.
149
169
150
-
## Change App Name
170
+
#### ☑️ Change App Name
151
171
152
172
By default, the app name that is configured in `config/app.php` is shown as a title on the login and throttle page. You can use a different title by setting this option:
You can publish the translations to quickly adjust the text on the login screen and the errors. If you want to customize the login page entirely, you can also publish the view.
190
+
You can publish the translations to quickly adjust the text on the login screen and the errors.
Laravel Debugbar will be disabled on the StageFront routes automatically if you use it in your project. This will hide any potential sensitive data from the public, if by accident Debugbar is running on your staging site. You can disable this feature by editing the `middleware` option in the [configuration file](#publish-configuration-file).
181
207
182
-
## Testing
208
+
## 🚧 Testing
183
209
210
+
```bash
211
+
composer test
184
212
```
185
-
vendor/bin/phpunit
186
-
```
187
213
188
-
## Security
214
+
## ☕️ Credits
215
+
216
+
-[Ivan Vermeyen](https://byterider.io/)
217
+
-[All contributors](../../contributors)
218
+
219
+
## 🔓 Security
189
220
190
221
If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.
191
222
192
-
## Changelog
223
+
## 📑 Changelog
193
224
194
-
See a list of important changes in the [changelog](https://github.com/codezero-be/laravel-stagefront/blob/master/CHANGELOG.md).
225
+
See a list of important changes in the [changelog](CHANGELOG.md).
195
226
196
-
## License
227
+
## 📜 License
197
228
198
-
The MIT License (MIT). Please see [License File](https://github.com/codezero-be/laravel-stagefront/blob/master/LICENSE.md) for more information.
229
+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
0 commit comments