반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 변수
- android
- express
- Eclipse
- 그림으로 배우는 서버구조
- 설치
- 정보처리기사
- 스나이퍼팩토리
- jquery
- php변수
- ios
- php개발
- script
- Kotlin
- 이클립스
- 플러터
- 스터디
- java
- kotlin2.0
- SwiftUI
- node.js
- 코틀린
- Coroutine
- node
- php
- Flow
- 조건문
- Flutter
- kotlininaction
- 서버
Archives
- Today
- Total
mygomii
[script&Jquery] #비밀번호 유효성(회원가입) - 영문+숫자+특수문자 본문
반응형
비밀번호 유효성
1 2 3 | id : <imput type="text" id="id"> password : <imput type="password" id="password"> | cs |
1. 특수문자+영문+숫자 조합
2. 같은문자반복 false
3. 아이디 포함 x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | $("#password").change(function(){ checkPassword($('#password').val(),$('id').val()); }); function checkPassword(password,id){ if(!/^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{8,25}$/.test(password)){ alert('숫자+영문자+특수문자 조합으로 8자리 이상 사용해야 합니다.'); $('#password').val('').focus(); return false; } var checkNumber = password.search(/[0-9]/g); var checkEnglish = password.search(/[a-z]/ig); if(checkNumber <0 || checkEnglish <0){ alert("숫자와 영문자를 혼용하여야 합니다."); $('#password').val('').focus(); return false; } if(/(\w)\1\1\1/.test(password)){ alert('같은 문자를 4번 이상 사용하실 수 없습니다.'); $('#password').val('').focus(); return false; } if(password.search(id) > -1){ alert("비밀번호에 아이디가 포함되었습니다."); $('#password').val('').focus(); return false; } return true; } | cs |
반응형
'JavaScript&JQuery' 카테고리의 다른 글
[script&Jquery] #두개의 날짜 범위 설정 datepicker (0) | 2018.05.02 |
---|---|
[script&Jquery] #빈값(null) 체크하기 (1) | 2018.04.24 |
[script&Jquery] #체크박스 전체선택&해제&삭제하기 (2) | 2018.04.20 |
[script&Jquery] #쿠키(Cookie)를 이용한 ID정보기억 (0) | 2018.03.17 |
[script] #쿠키를 위한 함수(setCookie,getCookie,deleteCookie) (2) | 2018.03.17 |