공통데이터 관리 수정
This commit is contained in:
@@ -237,3 +237,33 @@ function han($s)
|
||||
}
|
||||
// function to_han ($str) { return preg_replace('/(\\\u[a-f0-9]+)+/e','han("$0")',$str); }
|
||||
|
||||
/**
|
||||
* 비밀번호 문자 조합 검사
|
||||
* - 영문 대문자 / 소문자 / 숫자 / 특수문자 중 최소 $minTypes 종류 이상
|
||||
*/
|
||||
function checkPasswordTypes(string $password, int $minTypes = 2): bool
|
||||
{
|
||||
$types = 0;
|
||||
|
||||
// 대문자
|
||||
if (preg_match('/[A-Z]/', $password)) {
|
||||
$types++;
|
||||
}
|
||||
|
||||
// 소문자
|
||||
if (preg_match('/[a-z]/', $password)) {
|
||||
$types++;
|
||||
}
|
||||
|
||||
// 숫자
|
||||
if (preg_match('/[0-9]/', $password)) {
|
||||
$types++;
|
||||
}
|
||||
|
||||
// 특수문자 (공백 제외)
|
||||
if (preg_match('/[^A-Za-z0-9]/', $password)) {
|
||||
$types++;
|
||||
}
|
||||
|
||||
return $types >= $minTypes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user