new EzPasswordRule(name, rule, messageopt)
Examples
//기본형태
const rule = new nexacro.EzPasswordRule('TEST_RULE', function(pw){ return false }) //결과 기본형태는 boolean
//오류시 메시지는 nexacro.EzPasswordRule.i18nConfig의 TEST_RULE 값 사용
//오류메시지 키가 name과 다를경우
const rule = new nexacro.EzPasswordRule('TEST_RULE2', function(pw){ return false }, 'KEY:TEST_RULE')
//오류시 메시지는 nexacro.EzPasswordRule.i18nConfig의 TEST_RULE 값 사용
//Object 메시지 사용 시
const rule = new nexacro.EzPasswordRule('TEST_RULE3', function(pw){ return false }, { ko: '비밀번호 양식 오류' })
//오류시 메시지는 입력된 object에서 현재 언어코드에 해당하는 메시지를 사용
//오류 메시지에 동적 값 바인딩이 필요한 경우(특정 문자 사용 금지 예시)
//TEST_RULE 값이 '{0}은 사용할 수 없습니다' 일 경우 가정
const rule = new nexacro.EzPasswordRule('TEST_RULE3', function(pw){
const result = /([\#|\|])/.exec(pw);
if(result){
return { valid: false, fileds: [result[1]] } // 결과가 object일 경우 valid값이 정합성 검증값임, fileds값은 메시지에 바인딩처리됨
}
return true;
}, 'TEST_RULE')
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string | 룰 명칭 |
|
rule |
function | 룰 체크 함수 |
|
message |
string | object |
<optional> |
벨리데이션 오류 메시지
|
Members
(static, readonly) RULES :nexacro.EzPasswordRule
Properties:
| Name | Type | Description |
|---|---|---|
SIZE |
nexacro.EzPasswordRule | 길이제한 |
NOT_CONTAINS_BLANK |
nexacro.EzPasswordRule | 공백문자금지 |
START_ENG |
nexacro.EzPasswordRule | 영문으로시작 |
CONTAINS_PATTERN |
nexacro.EzPasswordRule | 포함패턴 |
NOT_RESERV |
nexacro.EzPasswordRule | 흔한 문자 포함 금지 |
NOT_CONTINUOUS |
nexacro.EzPasswordRule | 연속문자 금지 |
NOT_REPEATED |
nexacro.EzPasswordRule | 반복문자 금지 |
Type:
Methods
(static) getClassI18nMessage(key) → {string}
- Description:
nexacro.EzPasswordRule 내장 메시지 가져오기
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | 메시지코드 |
Returns:
메시지
- Type
- string