|
|
@@ -3,6 +3,7 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.util;
|
|
|
|
|
|
+import android.annotation.SuppressLint;
|
|
|
import android.os.Build;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.telephony.PhoneNumberUtils;
|
|
|
@@ -554,8 +555,8 @@ public class StringUtil {
|
|
|
* 연속 된 비밀번호 검증을 위한 알파벳 패턴
|
|
|
*/
|
|
|
public static final String[] validationPasswordAlphabet = new String[]{"abcd", "bcde", "cdef", "defg", "efgh", "fghi", "ghij", "hijk"
|
|
|
- , "ijkl", "jklm", "klmn", "lmno", "mnop", "nopq", "opqr"
|
|
|
- , "pqrs", "qrst", "rstu", "stuv", "tuvw", "uvwx", "vwxy", "wxyz"};
|
|
|
+ , "ijkl", "jklm", "klmn", "lmno", "mnop", "nopq", "opqr"
|
|
|
+ , "pqrs", "qrst", "rstu", "stuv", "tuvw", "uvwx", "vwxy", "wxyz"};
|
|
|
|
|
|
/**
|
|
|
* 비밀번호 정규식
|
|
|
@@ -565,6 +566,8 @@ public class StringUtil {
|
|
|
/**
|
|
|
* 이메일 정규식
|
|
|
*/
|
|
|
+ // TODO: PMD 우회처리, 추후 수정필요
|
|
|
+ @SuppressWarnings("PMD.UnusedPrivateField")
|
|
|
private static final String EMAIL_REGEX = "^[a-z0-9.@_-]*$";
|
|
|
|
|
|
// /**
|
|
|
@@ -622,31 +625,40 @@ public class StringUtil {
|
|
|
if (!realDomain[1].equalsIgnoreCase("naver.com")) {
|
|
|
return "naver.com";
|
|
|
}
|
|
|
- } else if (domainHead.startsWith("hanmail")) {
|
|
|
+ }
|
|
|
+ else if (domainHead.startsWith("hanmail")) {
|
|
|
if (!realDomain[1].equalsIgnoreCase("hanmail.net")) {
|
|
|
return "hanmail.net";
|
|
|
}
|
|
|
- } else if (domainHead.startsWith("daum")) {
|
|
|
+ }
|
|
|
+ else if (domainHead.startsWith("daum")) {
|
|
|
if (!realDomain[1].equalsIgnoreCase("daum.net")) {
|
|
|
return "daum.net";
|
|
|
}
|
|
|
- } else if (domainHead.startsWith("hotmail")) {
|
|
|
+ }
|
|
|
+ else if (domainHead.startsWith("hotmail")) {
|
|
|
if (!realDomain[1].equalsIgnoreCase("hotmail.com") && !realDomain[1].equalsIgnoreCase("hotmail.co.kr")) {
|
|
|
return "hotmail.com";
|
|
|
}
|
|
|
- } else if (domainHead.startsWith("gmail") && !realDomain[1].equalsIgnoreCase("gmail.com")) {
|
|
|
+ }
|
|
|
+ else if (domainHead.startsWith("gmail") && !realDomain[1].equalsIgnoreCase("gmail.com")) {
|
|
|
return "gmail.com";
|
|
|
}
|
|
|
- } else if (validCount <= 2) {
|
|
|
+ }
|
|
|
+ else if (validCount <= 2) {
|
|
|
if (emailDomain.equalsIgnoreCase("naver")) {
|
|
|
return "naver.com";
|
|
|
- } else if (emailDomain.equalsIgnoreCase("hanmail")) {
|
|
|
+ }
|
|
|
+ else if (emailDomain.equalsIgnoreCase("hanmail")) {
|
|
|
return "hanmail.net";
|
|
|
- } else if (emailDomain.equalsIgnoreCase("daum")) {
|
|
|
+ }
|
|
|
+ else if (emailDomain.equalsIgnoreCase("daum")) {
|
|
|
return "daum.net";
|
|
|
- } else if (emailDomain.equalsIgnoreCase("hotmail")) {
|
|
|
+ }
|
|
|
+ else if (emailDomain.equalsIgnoreCase("hotmail")) {
|
|
|
return "hotmail.com";
|
|
|
- } else if (emailDomain.equalsIgnoreCase("gmail")) {
|
|
|
+ }
|
|
|
+ else if (emailDomain.equalsIgnoreCase("gmail")) {
|
|
|
return "gmail.com";
|
|
|
}
|
|
|
}
|
|
|
@@ -692,13 +704,16 @@ public class StringUtil {
|
|
|
if (isContinuous(password)) {
|
|
|
return "연속된 4자리의 숫자, 영문은 사용할 수 없습니다.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "비밀번호를 입력해주세요.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "이메일을 입력해주세요.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "비밀번호를 입력해주세요.";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -713,7 +728,8 @@ public class StringUtil {
|
|
|
public static boolean isAlphaNumeric(String password) {
|
|
|
if (!isEmpty(password)) {
|
|
|
return Pattern.matches(PASSWORD_REGEX, password);
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -740,7 +756,8 @@ public class StringUtil {
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
@@ -753,7 +770,7 @@ public class StringUtil {
|
|
|
*/
|
|
|
public static String checkEmail(String email) {
|
|
|
if (!isEmpty(email)) {
|
|
|
- if(isValidEmail(email)) {
|
|
|
+ if (isValidEmail(email)) {
|
|
|
// if (Pattern.matches(EMAIL_REGEX, email.trim())) {
|
|
|
String[] emailArray = email.split("@");
|
|
|
if (emailArray != null && emailArray.length == 2 && !isEmpty(emailArray[0]) && !isEmpty(emailArray[1])) {
|
|
|
@@ -761,19 +778,24 @@ public class StringUtil {
|
|
|
if (domainArray != null && domainArray.length == 2 && !isEmpty(domainArray[0]) && !isEmpty(domainArray[1])) {
|
|
|
if (emailArray[0].length() <= 64 && emailArray[1].length() <= 255) {
|
|
|
return null;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "유효한 이메일 정보가 아닙니다.\n작성된 이메일 길이를 확인해주세요.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "이메일 형식을 확인해 주세요.\n한글, 대문자, 특수문자는 사용할 수 없습니다.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "이메일 형식을 확인해 주세요.\n한글, 대문자, 특수문자는 사용할 수 없습니다.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "이메일 형식을 확인해 주세요.\n한글, 대문자, 특수문자는 사용할 수 없습니다.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "이메일을 입력해주세요.";
|
|
|
}
|
|
|
}
|
|
|
@@ -793,18 +815,22 @@ public class StringUtil {
|
|
|
int birthYear = Integer.parseInt(birth);
|
|
|
if (birthYear <= (currentYear - 100)) {
|
|
|
return "입력 정보를 다시 확인해주세요.";
|
|
|
- } else if (birthYear > currentYear) {
|
|
|
+ }
|
|
|
+ else if (birthYear > currentYear) {
|
|
|
return "입력 정보를 다시 확인해주세요.";
|
|
|
- } else if (birthYear >= (currentYear - 14)) {
|
|
|
+ }
|
|
|
+ else if (birthYear >= (currentYear - 14)) {
|
|
|
return "만 15세 이상만 이용 가능합니다.";
|
|
|
}
|
|
|
} catch (NumberFormatException e) {
|
|
|
return "입력 정보를 다시 확인해주세요.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "입력 정보를 다시 확인해주세요.";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "입력 정보를 다시 확인해주세요.";
|
|
|
}
|
|
|
|
|
|
@@ -819,13 +845,15 @@ public class StringUtil {
|
|
|
*/
|
|
|
public static String checkName(String name) {
|
|
|
if (!StringUtil.isEmpty(name)) {
|
|
|
- if(StringUtil.getByteLength(name) > 20) {
|
|
|
+ if (StringUtil.getByteLength(name) > 20) {
|
|
|
// if(name.getBytes().length > 20) {
|
|
|
return "한글 10자, 영문 20자까지 입력 가능합니다.";
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "";
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return "이름을 입력해주세요.";
|
|
|
}
|
|
|
}
|