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