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,9 +80,10 @@ 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
-
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.
85
+
If you have existing users in the database and want to use those credentials, you can set `STAGEFRONT_DATABASE` to `true`.
86
+
The above login and password settings will then be ignored.
@@ -78,7 +97,9 @@ If you want to grant access to just a few of those users, you can whitelist them
78
97
79
98
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
99
81
-
## Change Route URL
100
+
## ⚙️ Other Options
101
+
102
+
#### ☑️ Change Route URL
82
103
83
104
By default a `GET` and `POST` route will be registered with the `/stagefront` URL.
84
105
@@ -92,7 +113,7 @@ It runs under the `web` middleware since it uses the session to keep you logged
92
113
93
114
You can change the middleware if needed in the [configuration file](#publish-configuration-file).
94
115
95
-
## Throttle Login Attempts
116
+
#### ☑️ Throttle Login Attempts
96
117
97
118
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
119
@@ -122,7 +143,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
149
@@ -137,7 +158,7 @@ For example:
137
158
],
138
159
```
139
160
140
-
## Link Live Site
161
+
#### ☑️ Link Live Site
141
162
142
163
If you set the URL to your live site, a link will be shown underneath the login form.
143
164
@@ -147,52 +168,63 @@ If you set the URL to your live site, a link will be shown underneath the login
147
168
148
169
Make sure you enter the full URL, including `https://`.
149
170
150
-
## Change App Name
171
+
#### ☑️ Change App Name
151
172
152
173
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.
191
+
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
208
182
-
## Testing
209
+
## 🚧 Testing
183
210
211
+
```bash
212
+
composer test
184
213
```
185
-
vendor/bin/phpunit
186
-
```
187
214
188
-
## Security
215
+
## ☕️ Credits
216
+
217
+
-[Ivan Vermeyen](https://byterider.io/)
218
+
-[All contributors](../../contributors)
219
+
220
+
## 🔓 Security
189
221
190
222
If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.
191
223
192
-
## Changelog
224
+
## 📑 Changelog
193
225
194
-
See a list of important changes in the [changelog](https://github.com/codezero-be/laravel-stagefront/blob/master/CHANGELOG.md).
226
+
See a list of important changes in the [changelog](CHANGELOG.md).
195
227
196
-
## License
228
+
## 📜 License
197
229
198
-
The MIT License (MIT). Please see [License File](https://github.com/codezero-be/laravel-stagefront/blob/master/LICENSE.md) for more information.
230
+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
0 commit comments