Adjust allowed maximum password length to 32
This commit is contained in:
parent
efe5c6229c
commit
da48fd84dc
|
|
@ -28,7 +28,7 @@ class AuthController extends Controller
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'identification' => 'required',
|
'identification' => 'required',
|
||||||
'password' => 'required|min:6|max:64'
|
'password' => 'required|min:6|max:32'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$identification = $request->input('identification');
|
$identification = $request->input('identification');
|
||||||
|
|
@ -110,7 +110,7 @@ class AuthController extends Controller
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
'password' => 'required|min:8|max:16',
|
'password' => 'required|min:8|max:32',
|
||||||
'nickname' => 'required|nickname|max:255'
|
'nickname' => 'required|nickname|max:255'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ class AuthController extends Controller
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'uid' => 'required|integer',
|
'uid' => 'required|integer',
|
||||||
'password' => 'required|min:8|max:16',
|
'password' => 'required|min:8|max:32',
|
||||||
'token' => 'required',
|
'token' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ describe('tests for "register" module', () => {
|
||||||
expect(showMsg).toBeCalledWith('auth.invalidPassword', 'warning');
|
expect(showMsg).toBeCalledWith('auth.invalidPassword', 'warning');
|
||||||
expect($('#password').is(':focus')).toBe(true);
|
expect($('#password').is(':focus')).toBe(true);
|
||||||
|
|
||||||
$('#password').val('too_long_password');
|
$('#password').val('too_long_password_very_super_long');
|
||||||
$('#password').blur();
|
$('#password').blur();
|
||||||
$('button').click();
|
$('button').click();
|
||||||
expect(trans).toBeCalledWith('auth.invalidPassword');
|
expect(trans).toBeCalledWith('auth.invalidPassword');
|
||||||
|
|
@ -372,7 +372,7 @@ describe('tests for "reset" module', () => {
|
||||||
expect(showMsg).toBeCalledWith('auth.invalidPassword', 'warning');
|
expect(showMsg).toBeCalledWith('auth.invalidPassword', 'warning');
|
||||||
expect($('#password').is(':focus')).toBe(true);
|
expect($('#password').is(':focus')).toBe(true);
|
||||||
|
|
||||||
$('#password').val('too_long_password');
|
$('#password').val('too_long_password_very_super_long');
|
||||||
$('#password').blur();
|
$('#password').blur();
|
||||||
$('button').click();
|
$('button').click();
|
||||||
expect(trans).toBeCalledWith('auth.invalidPassword');
|
expect(trans).toBeCalledWith('auth.invalidPassword');
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ $('#register-button').click(e => {
|
||||||
} else if (password === '') {
|
} else if (password === '') {
|
||||||
showMsg(trans('auth.emptyPassword'));
|
showMsg(trans('auth.emptyPassword'));
|
||||||
$('#password').focus();
|
$('#password').focus();
|
||||||
} else if (password.length < 8 || password.length > 16) {
|
} else if (password.length < 8 || password.length > 32) {
|
||||||
showMsg(trans('auth.invalidPassword'), 'warning');
|
showMsg(trans('auth.invalidPassword'), 'warning');
|
||||||
$('#password').focus();
|
$('#password').focus();
|
||||||
} else if ($('#confirm-pwd').val() === '') {
|
} else if ($('#confirm-pwd').val() === '') {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
// Register
|
// Register
|
||||||
emptyEmail: 'Empty email address.',
|
emptyEmail: 'Empty email address.',
|
||||||
invalidEmail: 'Invalid format of email address.',
|
invalidEmail: 'Invalid format of email address.',
|
||||||
invalidPassword: 'Invalid password. The length of password should between 8 and 16.',
|
invalidPassword: 'Invalid password. The length of password should between 8 and 32.',
|
||||||
emptyConfirmPwd: 'Empty confirming password.',
|
emptyConfirmPwd: 'Empty confirming password.',
|
||||||
invalidConfirmPwd: 'Confirming password is not equal with password.',
|
invalidConfirmPwd: 'Confirming password is not equal with password.',
|
||||||
emptyNickname: 'Empty nickname.',
|
emptyNickname: 'Empty nickname.',
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
// Register
|
// Register
|
||||||
emptyEmail: '你还没有填写邮箱哦',
|
emptyEmail: '你还没有填写邮箱哦',
|
||||||
invalidEmail: '邮箱格式不正确!',
|
invalidEmail: '邮箱格式不正确!',
|
||||||
invalidPassword: '无效的密码。密码长度应该大于 8 并小于 16。',
|
invalidPassword: '无效的密码。密码长度应该大于 8 并小于 32。',
|
||||||
emptyConfirmPwd: '确认密码不能为空',
|
emptyConfirmPwd: '确认密码不能为空',
|
||||||
invalidConfirmPwd: '密码和确认的密码不一样诶?',
|
invalidConfirmPwd: '密码和确认的密码不一样诶?',
|
||||||
emptyNickname: '你还没有填写昵称哦',
|
emptyNickname: '你还没有填写昵称哦',
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class AuthControllerTest extends TestCase
|
||||||
'msg' => trans('validation.min.string', ['attribute' => 'password', 'min' => 6])
|
'msg' => trans('validation.min.string', ['attribute' => 'password', 'min' => 6])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Should return a warning if length of `password` is greater than 64
|
// Should return a warning if length of `password` is greater than 32
|
||||||
$this->post(
|
$this->post(
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $user->email,
|
'identification' => $user->email,
|
||||||
|
|
@ -71,7 +71,7 @@ class AuthControllerTest extends TestCase
|
||||||
'X-Requested-With' => 'XMLHttpRequest'
|
'X-Requested-With' => 'XMLHttpRequest'
|
||||||
])->seeJson([
|
])->seeJson([
|
||||||
'errno' => 1,
|
'errno' => 1,
|
||||||
'msg' => trans('validation.max.string', ['attribute' => 'password', 'max' => 64])
|
'msg' => trans('validation.max.string', ['attribute' => 'password', 'max' => 32])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->flushSession();
|
$this->flushSession();
|
||||||
|
|
@ -255,18 +255,18 @@ class AuthControllerTest extends TestCase
|
||||||
'msg' => trans('validation.min.string', ['attribute' => 'password', 'min' => 8])
|
'msg' => trans('validation.min.string', ['attribute' => 'password', 'min' => 8])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Should return a warning if length of `password` is greater than 16
|
// Should return a warning if length of `password` is greater than 32
|
||||||
$this->post(
|
$this->post(
|
||||||
'/auth/register',
|
'/auth/register',
|
||||||
[
|
[
|
||||||
'email' => 'a@b.c',
|
'email' => 'a@b.c',
|
||||||
'password' => str_random(17),
|
'password' => str_random(33),
|
||||||
'captcha' => 'a'
|
'captcha' => 'a'
|
||||||
],
|
],
|
||||||
['X-Requested-With' => 'XMLHttpRequest']
|
['X-Requested-With' => 'XMLHttpRequest']
|
||||||
)->seeJson([
|
)->seeJson([
|
||||||
'errno' => 1,
|
'errno' => 1,
|
||||||
'msg' => trans('validation.max.string', ['attribute' => 'password', 'max' => 16])
|
'msg' => trans('validation.max.string', ['attribute' => 'password', 'max' => 32])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Should return a warning if `nickname` is empty
|
// Should return a warning if `nickname` is empty
|
||||||
|
|
@ -634,12 +634,12 @@ class AuthControllerTest extends TestCase
|
||||||
$this->post(
|
$this->post(
|
||||||
'/auth/reset', [
|
'/auth/reset', [
|
||||||
'uid' => $user->uid,
|
'uid' => $user->uid,
|
||||||
'password' => str_random(17)
|
'password' => str_random(33)
|
||||||
], [
|
], [
|
||||||
'X-Requested-With' => 'XMLHttpRequest'
|
'X-Requested-With' => 'XMLHttpRequest'
|
||||||
])->seeJson([
|
])->seeJson([
|
||||||
'errno' => 1,
|
'errno' => 1,
|
||||||
'msg' => trans('validation.max.string', ['attribute' => 'password', 'max' => 16])
|
'msg' => trans('validation.max.string', ['attribute' => 'password', 'max' => 32])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Should be forbidden if `token` is missing
|
// Should be forbidden if `token` is missing
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user