Skip to content

Commit f37890e

Browse files
committed
Merge branch 'release/v5.3.8'
2 parents c7f5b78 + 1d7c23a commit f37890e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1119
-191
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [5.3.8] - 2019-08-21
7+
### Added
8+
- Added Azerbaijan language (https://github.com/rappasoft/laravel-boilerplate/pull/1254)
9+
- Added NIST Password Rules (https://github.com/rappasoft/laravel-boilerplate/pull/1258)
10+
11+
### Changed
12+
- Assign all permissions to the Admin role without the need to explicitly assign the roles/permissions to the user. (https://github.com/rappasoft/laravel-boilerplate/pull/1227)
13+
14+
### Removed
15+
- Removed default Google scopes (https://github.com/rappasoft/laravel-boilerplate/pull/1253/files)
16+
- Removed ChangePassword rule as the new NIST rules cover it
17+
618
## 5.3.7 - 2019-08-21
719
### Added
820
- Actual changelog
@@ -95,4 +107,5 @@ All notable changes to this project will be documented in this file.
95107
- Fix yarn tests
96108
- Fix: Socially logged in users get assigned the default role
97109

98-
[Unreleased]: https://github.com/rappasoft/laravel-boilerplate/compare/v5.3.7...HEAD
110+
[Unreleased]: https://github.com/rappasoft/laravel-boilerplate/compare/v5.3.8...HEAD
111+
[5.3.8]: https://github.com/olivierlacan/keep-a-changelog/compare/v5.3.7...v5.3.8

app/Http/Controllers/Frontend/Auth/LoginController.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use App\Events\Frontend\Auth\UserLoggedIn;
1111
use App\Events\Frontend\Auth\UserLoggedOut;
1212
use Illuminate\Foundation\Auth\AuthenticatesUsers;
13+
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
1314

1415
/**
1516
* Class LoginController.
@@ -47,6 +48,22 @@ public function username()
4748
return config('access.users.username');
4849
}
4950

51+
/**
52+
* Validate the user login request.
53+
*
54+
* @param \Illuminate\Http\Request $request
55+
* @return void
56+
*
57+
* @throws \Illuminate\Validation\ValidationException
58+
*/
59+
protected function validateLogin(Request $request)
60+
{
61+
$request->validate([
62+
$this->username() => 'required|string',
63+
'password' => PasswordRules::login(),
64+
]);
65+
}
66+
5067
/**
5168
* The user has been authenticated.
5269
*

app/Http/Requests/Backend/Auth/User/StoreUserRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Validation\Rule;
66
use Illuminate\Foundation\Http\FormRequest;
7+
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
78

89
/**
910
* Class StoreUserRequest.
@@ -31,7 +32,7 @@ public function rules()
3132
'first_name' => ['required', 'max:191'],
3233
'last_name' => ['required', 'max:191'],
3334
'email' => ['required', 'email', 'max:191', Rule::unique('users')],
34-
'password' => ['required', 'min:6', 'confirmed'],
35+
'password' => PasswordRules::register($this->email),
3536
'roles' => ['required', 'array'],
3637
];
3738
}

app/Http/Requests/Backend/Auth/User/UpdateUserPasswordRequest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace App\Http\Requests\Backend\Auth\User;
44

5-
use App\Rules\Auth\ChangePassword;
65
use App\Rules\Auth\UnusedPassword;
76
use Illuminate\Foundation\Http\FormRequest;
8-
use DivineOmega\LaravelPasswordExposedValidationRule\PasswordExposed;
7+
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
98

109
/**
1110
* Class UpdateUserPasswordRequest.
@@ -30,13 +29,12 @@ public function authorize()
3029
public function rules()
3130
{
3231
return [
33-
'password' => [
34-
'required',
35-
'confirmed',
36-
new ChangePassword(),
37-
new PasswordExposed(),
38-
new UnusedPassword((int) $this->segment(4)),
39-
],
32+
'password' => array_merge(
33+
[
34+
new UnusedPassword((int) $this->segment(4)),
35+
],
36+
PasswordRules::changePassword($this->email)
37+
),
4038
];
4139
}
4240
}

app/Http/Requests/Frontend/Auth/RegisterRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Validation\Rule;
66
use Illuminate\Foundation\Http\FormRequest;
7+
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
78

89
/**
910
* Class RegisterRequest.
@@ -31,7 +32,7 @@ public function rules()
3132
'first_name' => ['required', 'string', 'max:191'],
3233
'last_name' => ['required', 'string', 'max:191'],
3334
'email' => ['required', 'string', 'email', 'max:191', Rule::unique('users')],
34-
'password' => ['required', 'string', 'min:6', 'confirmed'],
35+
'password' => PasswordRules::register($this->email),
3536
'g-recaptcha-response' => ['required_if:captcha_status,true', 'captcha'],
3637
];
3738
}

app/Http/Requests/Frontend/Auth/ResetPasswordRequest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace App\Http\Requests\Frontend\Auth;
44

5-
use App\Rules\Auth\ChangePassword;
65
use App\Rules\Auth\UnusedPassword;
76
use Illuminate\Foundation\Http\FormRequest;
8-
use DivineOmega\LaravelPasswordExposedValidationRule\PasswordExposed;
7+
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
98

109
/**
1110
* Class ResetPasswordRequest.
@@ -32,13 +31,12 @@ public function rules()
3231
return [
3332
'token' => ['required'],
3433
'email' => ['required', 'email'],
35-
'password' => [
36-
'required',
37-
'confirmed',
38-
new ChangePassword(),
39-
new PasswordExposed(),
40-
new UnusedPassword($this->get('token')),
41-
],
34+
'password' => array_merge(
35+
[
36+
new UnusedPassword($this->get('token')),
37+
],
38+
PasswordRules::changePassword($this->email)
39+
),
4240
];
4341
}
4442
}

app/Http/Requests/Frontend/User/UpdatePasswordRequest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace App\Http\Requests\Frontend\User;
44

5-
use App\Rules\Auth\ChangePassword;
65
use App\Rules\Auth\UnusedPassword;
76
use Illuminate\Foundation\Http\FormRequest;
8-
use DivineOmega\LaravelPasswordExposedValidationRule\PasswordExposed;
7+
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
98

109
/**
1110
* Class UpdatePasswordRequest.
@@ -31,13 +30,15 @@ public function rules()
3130
{
3231
return [
3332
'old_password' => ['required'],
34-
'password' => [
35-
'required',
36-
'confirmed',
37-
new ChangePassword(),
38-
new PasswordExposed(),
39-
new UnusedPassword($this->user()),
40-
],
33+
'password' => array_merge(
34+
[
35+
new UnusedPassword($this->user()),
36+
],
37+
PasswordRules::changePassword(
38+
$this->email,
39+
config('access.users.password_history') ? 'old_password' : null
40+
)
41+
),
4142
];
4243
}
4344
}

app/Providers/AuthServiceProvider.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Providers;
44

5+
use Gate;
56
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
67

78
/**
@@ -25,6 +26,10 @@ public function boot()
2526
{
2627
$this->registerPolicies();
2728

28-
//
29+
// Implicitly grant "Admin" role all permissions
30+
// This works in the app by using gate-related functions like auth()->user->can() and @can()
31+
Gate::before(function ($user, $ability) {
32+
return $user->hasRole(config('access.users.admin_role')) ? true : null;
33+
});
2934
}
3035
}

app/Rules/Auth/ChangePassword.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"beyondcode/laravel-self-diagnosis": "^1.0",
1616
"creativeorange/gravatar": "~1.0",
1717
"davejamesmiller/laravel-breadcrumbs": "^5.0",
18-
"divineomega/laravel-password-exposed-validation-rule": "^2.0.1",
1918
"fideloper/proxy": "^4.0",
2019
"hieu-le/active": "^3.5",
20+
"langleyfoxall/laravel-nist-password-rules": "^4.0",
2121
"laravel/framework": "5.8.*",
2222
"laravel/socialite": "^4.1",
2323
"laravel/tinker": "^1.0",

0 commit comments

Comments
 (0)