|
|
@@ -20,8 +20,9 @@
|
|
|
#define ksMasterSignUP @"3"; // 마스터 회원가입
|
|
|
|
|
|
@interface CertificationViewController () <CustomTextFieldDelegate>{
|
|
|
-
|
|
|
+
|
|
|
NSString *signType;
|
|
|
+ BOOL certificate;
|
|
|
}
|
|
|
|
|
|
@end
|
|
|
@@ -30,7 +31,7 @@
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
-
|
|
|
+
|
|
|
[self initUI];
|
|
|
}
|
|
|
|
|
|
@@ -39,15 +40,16 @@
|
|
|
|
|
|
[self.navigationController.navigationBar setHidden:YES];
|
|
|
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
|
|
|
-
|
|
|
+
|
|
|
+ certificate = NO;
|
|
|
_btnSend.enabled = _btnNext.enabled = NO;
|
|
|
-
|
|
|
+
|
|
|
[_lblStep setColor:kUITextColor03 text:[NSString stringWithFormat:@"%@", @"/ 5"]];
|
|
|
|
|
|
[self initTextField:_txtPhoneNum];
|
|
|
[self initTextField:_txtCertifyInput];
|
|
|
|
|
|
-
|
|
|
+
|
|
|
[self.btnSend setBackgroundImage:[UIImage imageNamed:@"img_btn_common_active"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
|
|
|
|
|
|
[self.btnSend setBackgroundImage:[UIImage imageNamed:@"img_btn_common_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
|
|
|
@@ -59,7 +61,7 @@
|
|
|
BOOL isMember = [[JDFacade facade].signType isEqualToString:KNEET_MEMBER_MASTER] ;
|
|
|
[self hiddenSendButton:isMember];
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)initTextField:(UITextField*)textFiled {
|
|
|
@@ -72,7 +74,7 @@
|
|
|
|
|
|
// 휴대폰 번호 인증 확인 요청
|
|
|
- (void)requestValidNum {
|
|
|
-
|
|
|
+
|
|
|
NSDictionary *parameter = @{@"phone": _txtPhoneNum.text,
|
|
|
@"auth_number" : _txtCertifyInput.text,
|
|
|
@"send_type" : @"U",
|
|
|
@@ -113,7 +115,7 @@
|
|
|
JDErrorModel *error = (JDErrorModel *)errorObject;
|
|
|
[[JDFacade facade] alert:error.errorMessage];
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 인증번호 전송 ( 멤버 회원가입만 해당 )
|
|
|
@@ -121,12 +123,13 @@
|
|
|
//parameters
|
|
|
NSDictionary *parameter = @{@"phone": _txtPhoneNum.text,
|
|
|
@"auth_type": signType};
|
|
|
-
|
|
|
+
|
|
|
NSString *path = API_POST_REQUEST_AUTH_NUM;
|
|
|
-
|
|
|
+
|
|
|
[[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
|
|
|
|
|
|
- _lblMessage.text = @"인증번호는 전송 후 3분 동안 유효 합니다";
|
|
|
+ certificate = YES;
|
|
|
+ _lblMessage.text = @"인증번호는 전송 후 3분 동안 유효 합니다";
|
|
|
[_btnSend setTitle: @"인증번호 재전송" forState : UIControlStateNormal];
|
|
|
|
|
|
} failure:^(id errorObject) {
|
|
|
@@ -153,10 +156,10 @@
|
|
|
_lblMessage.text = @"마스터 사용자에게 초대 SMS를 받은 번호만\n인증이 가능합니다.";
|
|
|
signType = ksSimpleSignUp; // 인증 타입 멤버로 설정
|
|
|
|
|
|
- _txtPhoneNum.hasMoveButton = _txtCertifyInput.hasMoveButton = NO;
|
|
|
-
|
|
|
- [_txtPhoneNum refreshAccessoryView];
|
|
|
- [_txtCertifyInput refreshAccessoryView];
|
|
|
+ // _txtPhoneNum.hasMoveButton = _txtCertifyInput.hasMoveButton = NO;
|
|
|
+ //
|
|
|
+ // [_txtPhoneNum refreshAccessoryView];
|
|
|
+ // [_txtCertifyInput refreshAccessoryView];
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -168,7 +171,7 @@
|
|
|
|
|
|
// 메뉴 닫기
|
|
|
- (IBAction)btnCancelTouched:(id)sender {
|
|
|
-
|
|
|
+
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
}
|
|
|
|
|
|
@@ -183,30 +186,40 @@
|
|
|
- (void)textFieldDidEndEditing:(UITextField *)textField{
|
|
|
|
|
|
// 휴대폰 번호가 10자리 이상 입력 된 경우 다음 버튼 활성화
|
|
|
- BOOL enabledPhoneNumber = _txtPhoneNum.text.length >= 10;
|
|
|
- _btnSend.enabled = enabledPhoneNumber;
|
|
|
- _btnNext.enabled = enabledPhoneNumber;
|
|
|
-
|
|
|
-
|
|
|
+ // BOOL enabledPhoneNumber = _txtPhoneNum.text.length >= 10;
|
|
|
+ // _btnSend.enabled = enabledPhoneNumber;
|
|
|
+ // _btnNext.enabled = enabledPhoneNumber;
|
|
|
+ //
|
|
|
+ //
|
|
|
// 인증번호가 4자리가 입력 된 경우 다음 버튼 활성화
|
|
|
- _btnNext.enabled = _txtCertifyInput.text.length >= 4;
|
|
|
-
|
|
|
+ _btnNext.enabled = certificate && _txtCertifyInput.text.length >= 4 ;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 휴대폰 번호 및 인증번호 최대 입력가능한 텍스트 설정
|
|
|
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
|
|
|
|
- // 휴대폰 번호입력 최대 11글자
|
|
|
+ NSString *text = [textField.text stringByReplacingCharactersInRange:range withString:string];
|
|
|
+
|
|
|
if ([textField isEqual:_txtPhoneNum]) {
|
|
|
- if (textField.text.length >= 11 && range.length == 0) {
|
|
|
- return NO;
|
|
|
- }
|
|
|
- // 인증번호 최대 4글자
|
|
|
- } else if([textField isEqual:_txtCertifyInput]){
|
|
|
- if (textField.text.length >= 4 && range.length == 0) {
|
|
|
- return NO;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ _btnSend.enabled = text.length >= 10;
|
|
|
+ certificate = NO;
|
|
|
+ }
|
|
|
+
|
|
|
+ NSLog(@"text : %@", text);
|
|
|
+
|
|
|
+ // 휴대폰 번호입력 최대 11글자
|
|
|
+ if ([textField isEqual:_txtPhoneNum] && text.length > 11) {
|
|
|
+
|
|
|
+ return NO;
|
|
|
+
|
|
|
+ // 인증번호 최대 4글자
|
|
|
+ } else if([textField isEqual:_txtCertifyInput] && text.length > 4){
|
|
|
+
|
|
|
+ return NO;
|
|
|
+
|
|
|
+ }
|
|
|
return YES;
|
|
|
}
|
|
|
|
|
|
@@ -228,7 +241,7 @@
|
|
|
- (void)moveToNextField:(id)sender {
|
|
|
|
|
|
[_txtCertifyInput becomeFirstResponder];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)moveToPrevField:(id)sender {
|