فهرست منبع

[회원가입][Bug] 모바일 인증 yyyymmdd 체크 로직 수정
- 이전에는 20000230 등 월과 일이 맞지 않는 경우를 체크하지 못했음

hyodong.min 7 سال پیش
والد
کامیت
28ad9bd1f8

+ 12 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/auth/MobileAuthPresenter.java

@@ -580,7 +580,7 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
     view.showRemainTime(isEnabled);
     view.setEnabledExpansionTimeButton(isEnabled);
 
-    if(false == isEnabled) {
+    if (false == isEnabled) {
       disposeRemainRendering();
     }
   }
@@ -677,7 +677,13 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
         .take(takingNumber)
         .subscribe(
           (Long tick) -> {
-            view.renderRetryButton(String.format("%s %s", ResourceUtil.getString(R.string.phone_identify_submit_retry), Formatter.format((finalTakingNumber - 1 - (int) (long) tick) * 1000, "mm:ss")));
+            view.renderRetryButton(
+              String.format(
+                "%s %s",
+                ResourceUtil.getString(R.string.phone_identify_submit_retry),
+                Formatter.format((finalTakingNumber - 1 - (int) (long) tick) * 1000, "mm:ss")
+              )
+            );
           }
           , Throwable::printStackTrace,
           () -> {
@@ -823,7 +829,10 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
       int month = Integer.valueOf(birthDate.substring(4, 6));
       int date = Integer.valueOf(birthDate.substring(6, 8));
 
-      if (year > 0 && month <= 12 && month > 0 && date <= 31 && date > 0) {
+      String verifyingDate = Formatter.format(birthDate, "yyyyMMdd", "yyyyMMdd");
+
+//      if (year > 0 && month <= 12 && month > 0 && date <= 31 && date > 0) {
+      if (birthDate.equals(verifyingDate)) {
         Log.i("APP# MobileAuthPresenter | verifyBirthDate", "|" + year + " " + month + " " + date);
 
         Calendar birthday = Calendar.getInstance();

+ 9 - 0
app/src/test/java/kr/co/zumo/app/lifeplus/util/FormatterTest.java

@@ -3,6 +3,7 @@ package kr.co.zumo.app.lifeplus.util;
 import org.junit.Test;
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotSame;
 
 /**
  * FormatterTest
@@ -22,4 +23,12 @@ public class FormatterTest {
     assertEquals("03:00", Formatter.format(180000, "mm:ss"));
     assertEquals("01:00", Formatter.format(60000, "mm:ss"));
   }
+
+  @Test
+  public void format1() {
+    assertEquals("19990101", Formatter.format("19990101", "yyyyMMdd", "yyyyMMdd"));
+    assertEquals("20171231", Formatter.format("20171231", "yyyyMMdd", "yyyyMMdd"));
+    assertEquals("11111111", Formatter.format("11111111", "yyyyMMdd", "yyyyMMdd"));
+    assertNotSame("20000231", Formatter.format("20000231", "yyyyMMdd", "yyyyMMdd"));
+  }
 }