Skip to content

Instantly share code, notes, and snippets.

@shlee322
Created February 17, 2015 04:28
Show Gist options
  • Save shlee322/548dc298661e94e3495e to your computer and use it in GitHub Desktop.
Save shlee322/548dc298661e94e3495e to your computer and use it in GitHub Desktop.
개인정보의 기술적·관리적 보호조치 기준에 따른 비밀번호 작성 규칙 체크 함수
function check_password(pwd) {
// Copyright (c) 2015 Lee Sahghyuck <shlee322@elab.kr>
// MIT License (http://opensource.org/licenses/mit-license.php)
// Author : Lee Sahghyuck <shlee322@elab.kr>
// Date : 2015.02.17
var char_type = 0;
if (/[a-z]/.test(pwd)) char_type = char_type + 1;
if (/[A-Z]/.test(pwd)) char_type = char_type + 1;
if (/[0-9]/.test(pwd)) char_type = char_type + 1;
if (/[~!@#$%\^&*()_+`\-={}|[\]\\:";'<>?,./]/gi.test(pwd)) char_type = char_type + 1;
return !(char_type < 2 || (char_type == 2 && pwd.length < 10) || pwd.length < 8);
}
// check_password('testtest') -> false
// check_password('testtest123') -> true
// check_password('asdf@qw1') -> true
@shlee322
Copy link
Author

개인정보의 기술적·관리적 보호조치 기준
제 4조(접근통제)
⑦ 정보통신서비스 제공자등은 이용자가 안전한 비밀번호를 이용할 수 있도록 비밀번호 작성규칙을 수립하고, 이행한다.
⑧ 정보통신서비스 제공자등은 개인정보취급자를 대상으로 다음 각 호의 사항을 포함하는 비밀번호 작성규칙을 수립하고, 이를 적용·운용하여야 한다.

1. 다음 각 목의 문자 종류 중 2종류 이상을 조합하여 최소 10자리 이상 또는 3종류 이상을 조합하여 최소 8자리 이상의 길이로 구성
가. 영문 대문자(26개)
나. 영문 소문자(26개)
다. 숫자(10개)
라. 특수문자(32개)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment