Grav 버전은 1.1.5입니다.
소스 코드에서 모든 유효성 검사 논리와 유효성 검사 패턴을 제거했지만 작동하지 않고 사용자를 만들 때 여전히 오류가 발생합니다.
오류 메시지 이름은 USERNAME_NOT_VALID
입니다. 모든 소스 코드에서 이것을 검색하고 관련 코드를 삭제했지만 오류가 발생하면 여전히 화면에 표시됩니다. 메시지가 어디에서 왔는지 모르겠습니다.
diff --git a/user/plugins/admin/pages/admin/register.md b/user/plugins/admin/pages/admin/register.md
index ff0b13b..fc0cf6e 100644
--- a/user/plugins/admin/pages/admin/register.md
+++ b/user/plugins/admin/pages/admin/register.md
@@ -9,7 +9,7 @@ form:
validate:
required: true
message: PLUGIN_LOGIN.USERNAME_NOT_VALID
- pattern: '^[a-z0-9_-]{3,16}$'
+ pattern: ''
- name: email
type: email
@@ -27,7 +27,7 @@ form:
validate:
required: true
message: PLUGIN_ADMIN.PASSWORD_VALIDATION_MESSAGE
- pattern: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}'
+ pattern: ''
- name: password2
type: password
@@ -36,7 +36,7 @@ form:
validate:
required: true
message: PLUGIN_ADMIN.PASSWORD_VALIDATION_MESSAGE
- pattern: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}'
+ pattern: ''
- name: fullname
type: text
diff --git a/user/plugins/login/pages/register.md b/user/plugins/login/pages/register.md
index c4088e2..0391367 100644
--- a/user/plugins/login/pages/register.md
+++ b/user/plugins/login/pages/register.md
@@ -12,7 +12,7 @@ form:
validate:
required: true
message: PLUGIN_LOGIN.USERNAME_NOT_VALID
- pattern: '^[a-z0-9_-]{3,16}$'
+ pattern: ''
-
name: email
@@ -31,7 +31,7 @@ form:
validate:
required: true
message: PLUGIN_LOGIN.PASSWORD_VALIDATION_MESSAGE
- pattern: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}'
+ pattern: ''
-
name: password2
@@ -41,7 +41,7 @@ form:
validate:
required: true
message: PLUGIN_LOGIN.PASSWORD_VALIDATION_MESSAGE
- pattern: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}'
+ pattern: ''
buttons:
-
diff --git a/user/plugins/login/pages/reset.md b/user/plugins/login/pages/reset.md
index e5f82e4..8300d2a 100644
--- a/user/plugins/login/pages/reset.md
+++ b/user/plugins/login/pages/reset.md
@@ -20,7 +20,7 @@ form:
validate:
required: true
message: PLUGIN_LOGIN.PASSWORD_VALIDATION_MESSAGE
- pattern: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}'
+ pattern: ''
- name: token
type: hidden
diff --git a/user/plugins/login/cli/ChangePasswordCommand.php b/user/plugins/login/cli/ChangePasswordCommand.php
index d15abb7..5bde6cc 100644
--- a/user/plugins/login/cli/ChangePasswordCommand.php
+++ b/user/plugins/login/cli/ChangePasswordCommand.php
@@ -134,9 +134,6 @@ class ChangePasswordCommand extends ConsoleCommand
{
switch ($type) {
case 'user':
- if (!preg_match('/^[a-z0-9_-]{3,16}$/', $value)) {
- throw new \RuntimeException('Username should be between 3 and 16 characters, including lowercase letters, numbers, underscores, and hyphens. Uppercase letters, spaces, and special characters are not allowed');
- }
if (!file_exists(self::getGrav()['locator']->findResource('account://' . $value . YAML_EXT))) {
throw new \RuntimeException('Username "' . $value . '" does not exist, please pick another username');
}
@@ -144,10 +141,6 @@ class ChangePasswordCommand extends ConsoleCommand
break;
case 'password1':
- if (!preg_match('/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}/', $value)) {
- throw new \RuntimeException('Password must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters');
- }
-
break;
case 'password2':
diff --git a/user/plugins/login/cli/ChangeUserStateCommand.php b/user/plugins/login/cli/ChangeUserStateCommand.php
index 40f9dc6..90adee6 100644
--- a/user/plugins/login/cli/ChangeUserStateCommand.php
+++ b/user/plugins/login/cli/ChangeUserStateCommand.php
@@ -133,9 +133,6 @@ class ChangeUserStateCommand extends ConsoleCommand
{
switch ($type) {
case 'user':
- if (!preg_match('/^[a-z0-9_-]{3,16}$/', $value)) {
- throw new \RuntimeException('Username should be between 3 and 16 characters, including lowercase letters, numbers, underscores, and hyphens. Uppercase letters, spaces, and special characters are not allowed');
- }
if (!file_exists(self::getGrav()['locator']->findResource('account://' . $value . YAML_EXT))) {
throw new \RuntimeException('Username "' . $value . '" does not exist, please pick another username');
}
diff --git a/user/plugins/login/cli/NewUserCommand.php b/user/plugins/login/cli/NewUserCommand.php
index 17dbf48..728adda 100644
--- a/user/plugins/login/cli/NewUserCommand.php
+++ b/user/plugins/login/cli/NewUserCommand.php
@@ -237,9 +237,6 @@ class NewUserCommand extends ConsoleCommand
{
switch ($type) {
case 'user':
- if (!preg_match('/^[a-z0-9_-]{3,16}$/', $value)) {
- throw new \RuntimeException('Username should be between 3 and 16 characters, including lowercase letters, numbers, underscores, and hyphens. Uppercase letters, spaces, and special characters are not allowed');
- }
if (file_exists(Grav::instance()['locator']->findResource('account://' . $value . YAML_EXT))) {
throw new \RuntimeException('Username "' . $value . '" already exists, please pick another username');
}
@@ -247,10 +244,6 @@ class NewUserCommand extends ConsoleCommand
break;
case 'password1':
- if (!preg_match('/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}/', $value)) {
- throw new \RuntimeException('Password must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters');
- }
-
break;
case 'password2':
소스 코드를 건드리지 않고 Grav에 직접 포함 된 변경 방법이 이미 있습니다.
관리자 패널로 이동하면 구성 아래에 "사용자 이름 정규식"과 "암호 정규식"을 각각 사용자 지정할 수있는 "고급"이라는 항목이 있습니다.
기본적으로 사용자 이름 regex는 ^[a-z0-9_-]{3,16}$
@Scuzzy가 주석에 명시한대로 ^(.*)^
모든 문자를 허용하도록 변경 될 수 있습니다 .
BTW 보안 및 가독성 측면에서 웹 사이트에서 ^ =-èö와 같은 unsername을 원하지 않는 한 해당 정규식을 사용하지 않는 것이 좋습니다.
Grav를 업데이트 할 때마다 모든 변경 사항을 되돌릴 수 있으므로 Grav 소스 코드를 직접 건드리지 않는 것이 좋습니다. 소스의 내용을 정말로 변경하고 싶다면 플러그인으로 생성하여 (개인적인 용도로도) 업데이트 기능을 유지할 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다