LoginViewController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. //
  2. // LoginViewController.m
  3. // kneet
  4. //
  5. // Created by Jason Lee on 2/4/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. @import QuartzCore;
  9. #import "RequestHandler.h"
  10. #import "CustomTextField.h"
  11. #import "CustomButton.h"
  12. #import "JDJSONModel.h"
  13. #import "LoginModel.h"
  14. #import "LoginViewController.h"
  15. #import "CustomLabel.h"
  16. #import "CustomCheckBox.h"
  17. #import "KeychainItemWrapper.h"
  18. #import "NewMobileViewController.h"
  19. #import "ValidateUtil.h"
  20. #import "CustomAlertView.h"
  21. #import "CustomImageView.h"
  22. #import "PwdPopupView.h"
  23. #import "QuizSetViewController.h"
  24. #import "TempPwViewController.h"
  25. //#import "MobilesOverViewController.h"
  26. //#import "InvitationListViewController.h"
  27. /**
  28. ID / PW Input Box Text Color
  29. - 기본 : kUITextColor01
  30. - Hint : kUITextColor03
  31. - Disable : kUITextColor06
  32. 로그인 유지 / 아이디 저장 Text Color : kUITextColor01
  33. 아이디 찾기 / 비밀번호 찾기 / 회원가입하기 Text Color
  34. - 아이디 찾기,비밀번호 찾기 : kUITextColor01
  35. - 회원가입 하기 : kUITextColor04
  36. **/
  37. @interface LoginViewController () <CustomTextFieldDelegate,dismissQuizViewDelegate> {
  38. }
  39. @end
  40. #pragma mark - Class Definition
  41. @implementation LoginViewController
  42. - (void)viewDidLoad {
  43. [super viewDidLoad];
  44. // Do any additional setup after loading the view.
  45. [self initUI];
  46. [self prepareViewDidLoad];
  47. }
  48. - (void)initUI {
  49. _btnLogin.enabled = NO;
  50. [self.btnLogin setBackgroundImage:[UIImage imageNamed:@"img_btn_common_active"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  51. [self.btnLogin setBackgroundImage:[UIImage imageNamed:@"img_btn_common_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  52. [self.btnLogin setBackgroundImage:[UIImage imageNamed:@"img_btn_common_disable"] forState:UIControlStateDisabled capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  53. [self.lblFindId setHidden:YES];
  54. CGRect screen = [UIScreen mainScreen].bounds;
  55. if (screen.size.height == 480) {//iphone4s
  56. [_imgvBg setImage:[UIImage imageNamed:@"img_login_bg_4inch"]];
  57. } if (screen.size.height == 667.0f) {//iphone6
  58. _constraintLeftPadding.constant *= 1.25;
  59. _constraintRightPadding.constant *= 1.25;
  60. } else if (screen.size.height == 736.0f) {//iphone6 plus
  61. _constraintLeftPadding.constant *= 1.5;
  62. _constraintRightPadding.constant *= 1.5;
  63. }
  64. // [self.view layoutIfNeeded];
  65. _txtEmail.customTextFieldSuperview = CustomTextFieldSuperviewIsScrollView;
  66. _txtPasswd.customTextFieldSuperview = CustomTextFieldSuperviewIsScrollView;
  67. _txtPasswd.secureTextEntry = YES;
  68. _txtEmail.keyboardType = UIKeyboardTypeDefault;
  69. _txtPasswd.keyboardType = UIKeyboardTypeDefault;
  70. _txtEmail.returnKeyType = UIReturnKeyNext;
  71. _txtPasswd.returnKeyType = UIReturnKeyDone;
  72. _txtPasswd.delegate = self;
  73. _txtEmail.delegate = self;
  74. //Localization
  75. [_chkAutoLogin setTitle:NSLocalizedString(@"로그인 유지", @"로그인 유지") forState:UIControlStateNormal];
  76. [_chkIdSave setTitle:NSLocalizedString(@"아이디 저장", @"아이디 저장") forState:UIControlStateNormal];
  77. _txtEmail.placeholder = NSLocalizedString(@"아이디", @"아이디");
  78. _txtPasswd.placeholder = NSLocalizedString(@"비밀번호", @"비밀번호");
  79. _lblSignUp.text = NSLocalizedString(@"회원가입", @"회원가입");
  80. _lblFindId.text = NSLocalizedString(@"아이디/비번찾기", @"아이디/비번찾기");
  81. // [_lblSignUp setUnderLine:_lblSignUp.text];
  82. [_lblSignUp addTouchEventHandler:^(id label) {
  83. [self lblSignUpTouched];
  84. }];
  85. [_lblFindId setUnderLine:_lblFindId.text];
  86. [_lblFindId addTouchEventHandler:^(id label) {
  87. [self lblFindIdTouched];
  88. }];
  89. }
  90. - (void)prepareViewDidLoad {
  91. [RequestHandler handler].authorization = nil;
  92. BOOL autoLogin = [[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_AUTO_LOGIN] boolValue];
  93. BOOL idSave = [[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] boolValue];
  94. _chkAutoLogin.checked = [[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_AUTO_LOGIN] != nil ? autoLogin : YES;
  95. _chkIdSave.checked = [[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] != nil ? idSave : YES;
  96. if (autoLogin) {
  97. [self requestAutoLogin];
  98. // _txtEmail.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  99. // _txtPasswd.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_PWD];
  100. //
  101. // [self btnLogInTouched:_btnLogin];
  102. }
  103. if (idSave) {
  104. _txtEmail.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  105. }
  106. }
  107. #pragma mark - Main Logic
  108. - (void)requestLogin {
  109. SocketRequestModel *request = [[SocketRequestModel alloc] initWithMsgType:MSG_TYPE_LOGIN];
  110. NSDictionary *param = @{@"member_id": [_txtEmail.text trim],
  111. @"password": [_txtPasswd.text trim],
  112. @"os_type": MOBILE_DEVICE_TYPE,
  113. @"device_token": [JDFacade facade].APNSToken ? [JDFacade facade].APNSToken : ksEmptyString};
  114. [request setRequestMsg:param];
  115. [self sendDataToSocket:request modelClass:[LoginModel class] isLoading:YES];
  116. }
  117. //자동로그인 요청
  118. - (void)requestAutoLogin {;
  119. LoginModel *tmpInfo = [[LoginModel alloc] init];
  120. tmpInfo.memberId = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  121. tmpInfo.authToken = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_AUTOTOKEN];
  122. SocketRequestModel *request = [[SocketRequestModel alloc] initWithMsgType:MSG_TYPE_AUTO_LOGIN];
  123. NSDictionary *param = @{@"Authorization": tmpInfo.authorization,
  124. @"device_token": [JDFacade facade].APNSToken ? [JDFacade facade].APNSToken : ksEmptyString,
  125. @"os_type": MOBILE_DEVICE_TYPE};
  126. [request setRequestMsg:param];
  127. [self sendDataToSocket:request modelClass:[LoginModel class] isLoading:YES];
  128. // NSString *path = [NSString stringWithFormat:API_GET_SIGN_IN_AUTO];
  129. //
  130. // [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:parameter modelClass:[LoginModel class] completion:^(id responseObject) {
  131. // if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
  132. // return;
  133. // }
  134. //
  135. // LoginModel *loginInfo = (LoginModel *)responseObject;
  136. //
  137. // if (loginInfo) {//API 성공 ,함
  138. // [self actionForLoginSucceed:loginInfo];
  139. //
  140. // }
  141. // } failure:^(id errorObject) {
  142. // JDErrorModel *error = (JDErrorModel *)errorObject;
  143. //
  144. // if ([error.errorCode isEqualToString:API_RESPONSE_UNAUTHORIZED_DEVICE]) {//새로운 단말 인증 필요
  145. // [self actionForNeedsRegisteringNewDevice:error.nickname];
  146. // } else {
  147. // [[JDFacade facade] alert:error.errorMessage];
  148. // }
  149. // }];
  150. }
  151. //인증 메일 재요청
  152. - (void)requestAuthMail {
  153. //parameters
  154. NSDictionary *parameter = @{@"email_id": [JDFacade facade].tmpEmailId};
  155. NSString *path = [NSString stringWithFormat:API_POST_AUTH_MAIL];
  156. [[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
  157. if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
  158. return;
  159. }
  160. JDJSONModel *result = (JDJSONModel *) responseObject;
  161. if (result) {//API 성공 ,
  162. [[JDFacade facade] toast:NSLocalizedString(@"인증 메일이 발송되었습니다", @"인증 메일이 발송되었습니다")];
  163. }
  164. } failure:^(id errorObject) {
  165. JDErrorModel *error = (JDErrorModel *)errorObject;
  166. [[JDFacade facade] alert:error.errorMessage];
  167. }];
  168. }
  169. //로그인 이후 처리.
  170. - (void)actionForLoginSucceed:(LoginModel *)loginInfo {
  171. if (loginInfo) {//API 성공함
  172. [JDFacade facade].loginUser = loginInfo;
  173. // [JDFacade facade].loginUser.gradeCode = KNEET_MEMBER_MASTER;
  174. // [JDFacade facade].loginUser.level = 90;
  175. NSLog(@"loginUser : %@", [JDFacade facade].loginUser);
  176. if ([[JDFacade facade].loginUser.emailId isEqualToString:[JDFacade facade].tmpEmailId]) {
  177. [JDFacade facade].tmpEmailId = ksEmptyString;
  178. }
  179. if ([[JDFacade facade].loginUser.emailId isEqualToString:[JDFacade facade].loginUser.newEmailId]) {//이메일 변경 요청 중
  180. [JDFacade facade].loginUser.newEmailId = ksEmptyString;
  181. }
  182. [RequestHandler handler].authorization = loginInfo.authorization;
  183. [[JDFacade facade] storeObjectToUserDefaults:@(_chkAutoLogin.checked) forKey:USDEF_APP_AUTO_LOGIN];
  184. [[JDFacade facade] storeObjectToUserDefaults:@(_chkIdSave.checked) forKey:USDEF_APP_SAVE_ID];
  185. if (_chkAutoLogin.checked) {//자동로그인 설정 시, 인증 토큰 저장
  186. [[JDFacade facade] storeObjectToKeychain:loginInfo.memberId forKey:USDEF_SESSION_LOGIN_ID];
  187. [[JDFacade facade] storeObjectToKeychain:loginInfo.authToken forKey:USDEF_SESSION_AUTOTOKEN];
  188. } else {
  189. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
  190. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_PWD];
  191. if (!_chkIdSave.checked) {
  192. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
  193. }
  194. }
  195. if (_chkIdSave.checked) {
  196. [[JDFacade facade] storeObjectToKeychain:[_txtEmail.text trim] forKey:USDEF_SESSION_LOGIN_ID];
  197. } else {
  198. if (!_chkAutoLogin.checked) {
  199. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
  200. }
  201. }
  202. [self actionAfterLogin];
  203. }
  204. }
  205. //퀴즈 설정 메뉴 dismiss 시
  206. - (void)dismissQuizView {
  207. [self actionAfterInvitaion];
  208. }
  209. //홈그룹 체크 및 대시보드 이동
  210. - (void)actionAfterLogin {
  211. if ([[JDFacade facade].loginUser.quiz isEqualToString:@""]) {
  212. QuizSetViewController *vc = (QuizSetViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"QuizSetViewController" storyboardName:@"Main"];
  213. vc.delegate = self;
  214. [self presentViewController:vc animated:YES completion:nil];
  215. return;
  216. }
  217. if ([[JDFacade facade].loginUser.invitationsCount integerValue] > 0) {
  218. [self actionForInvitation];
  219. return;
  220. }
  221. //임시 비밀번호 체크 후 이동
  222. if ([JDFacade facade].loginUser.tempPasswordYn && [[JDFacade facade].loginUser.tempPasswordYn boolValue]) {
  223. TempPwViewController *vc = (TempPwViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"TempPwSetViewController" storyboardName:@"SignUp"];
  224. [self presentViewController:vc animated:YES completion:nil];
  225. return;
  226. }
  227. [self actionAfterInvitaion];
  228. }
  229. //초대알림 화면으로 이동
  230. - (void)actionForInvitation {
  231. [[JDFacade facade] loadInvitationView];
  232. }
  233. //초대화면 액션이 종료된 후,
  234. - (void)actionAfterInvitaion {
  235. //메인으로 이동
  236. [self gotoMainView];
  237. }
  238. //새로운 단말 인증 필요 - 화면 이동
  239. - (void)actionForNeedsRegisteringNewDevice:(NSString *)nickname {
  240. NewMobileViewController *vc = (NewMobileViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"NewMobileViewController" storyboardName:@"SignUp"];
  241. vc.checkedAutoLogin = _chkAutoLogin.checked;
  242. vc.nickname = nickname;
  243. [[JDFacade facade] presentViewControllerByPush:vc pvc:self];
  244. }
  245. //단말대수 초과
  246. - (void)actionForMobilesOver:(NSArray<MobileDeviceModel> *)deviceList {
  247. //SHA-2
  248. }
  249. //인증대기중 - 화면 이동
  250. - (void)actionForWaiting {
  251. NSString *message1 = [NSString stringWithFormat:@"%@에서\n인증 메일을 확인하세요", [JDFacade facade].tmpEmailId];
  252. NSString *message2 = @"\n\n메일을 확인할 수 없는 경우에는\n스팸 메일함을 확인해보세요";
  253. CustomAlertView *alert = [[CustomAlertView alloc] initWithTitle:@"메일을 확인하세요" message:[NSString stringWithFormat:@"%@%@", message1, message2] delegate:nil OKButtonTitle:@"확인" cancelButtonTitle:nil];
  254. [alert.lblMessage1 setColor:kUITextColor02 text:message1];
  255. [alert showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
  256. if (buttonIndex == 1) {//재발송
  257. [self requestAuthMail];
  258. }
  259. }];
  260. }
  261. - (void)gotoMainView {
  262. // UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SignUpCompleteViewController" storyboardName:@"SignUp"];
  263. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"MainViewController" storyboardName:@"Main"];
  264. [JDFacade facade].mainViewController = (MainViewController *)vc;
  265. [[JDFacade facade].appDelegate.window setRootViewController:vc];
  266. }
  267. - (void)requestLogout {
  268. [JDFacade facade].loginUser = nil;
  269. [self actionAfterLogout];
  270. // NSDictionary *param = @{API_AUTHORIZATION_KEY: [[JDFacade facade].loginUser authorization],
  271. // @"message_type": @"auth.out"};
  272. //
  273. // [self sendDataToSocket:param];
  274. //parameters
  275. // [self actionAfterLogout];
  276. // NSString *path = [NSString stringWithFormat:API_POST_SIGN_OUT];
  277. //
  278. // [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:nil modelClass:[JDJSONModel class] completion:^(id responseObject) {
  279. // [self actionAfterLogout];
  280. //
  281. // } failure:^(id errorObject) {
  282. // JDErrorModel *error = (JDErrorModel *)errorObject;
  283. // [[JDFacade facade] alert:error.errorMessage];
  284. // }];
  285. }
  286. - (void)actionAfterLogout {
  287. //자동 로그인 설정 - 취소
  288. [[JDFacade facade] storeObjectToUserDefaults:@(NO) forKey:USDEF_APP_AUTO_LOGIN];
  289. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
  290. if (![[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] boolValue]) {
  291. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
  292. }
  293. [JDFacade facade].loginUser = nil;
  294. [self closeSocket];
  295. [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  296. //root view 변경
  297. [[JDFacade facade].appDelegate.window setRootViewController:self];
  298. }
  299. #pragma mark - UI Events
  300. - (IBAction)btnLogInTouched:(id)sender {
  301. //#ifdef DEBUG_MODE
  302. // if ([_txtEmail.text isEmptyString]) {
  303. // _txtEmail.text = @"asura77";//@"smiles1080";
  304. // }
  305. //
  306. // if ([_txtPasswd.text isEmptyString]) {
  307. // _txtPasswd.text = @"12345678a";//@"12341234aa";
  308. //
  309. // }
  310. //#endif
  311. // TODO : 아이디 형식 검사할것
  312. // if (![ValidateUtil validateTextfiled:_txtEmail type:ValidateTypeEmail title:@"이메일" ]) {
  313. // return;
  314. // }
  315. // if (![ValidateUtil validateTextfiled:_txtEmail type:ValidateTypeNull title:@"비밀번호" ]) {
  316. // return;
  317. // }
  318. [JDFacade facade].tmpEmailId = [_txtEmail.text trim];
  319. [JDFacade facade].tmpPassword = [_txtPasswd.text trim];
  320. [self requestLogin];
  321. }
  322. //회원가입 호출
  323. - (void)lblSignUpTouched {
  324. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SignUpTypeSelectViewController" storyboardName:@"SignUp"];
  325. UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
  326. [self presentViewController:m_navi animated:YES completion:nil];
  327. }
  328. - (void)lblFindIdTouched {
  329. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ResetPwdViewController" storyboardName:@"SignUp"];
  330. [self presentViewController:vc animated:YES completion:nil];
  331. }
  332. // 아이디 찾기 호출
  333. - (IBAction)btnIdFindTouched:(id)sender {
  334. NSLog(@"아이디 찾기");
  335. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"IdFindViewController" storyboardName:@"SignUp"];
  336. UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
  337. [self presentViewController:m_navi animated:YES completion:nil];
  338. }
  339. // 비밀번호 찾기 호출
  340. - (IBAction)btnPwFindTouched:(id)sender {
  341. NSLog(@"비밀번호 찾기");
  342. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"PwFindViewController" storyboardName:@"SignUp"];
  343. UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
  344. [self presentViewController:m_navi animated:YES completion:nil];
  345. }
  346. #pragma mark - CustomTextField
  347. - (BOOL)textFieldShouldReturn:(UITextField *)textField {
  348. if ([textField isEqual:_txtEmail])
  349. {
  350. [_txtPasswd becomeFirstResponder];
  351. }
  352. if ([textField isEqual:_txtPasswd])
  353. {
  354. [self btnLogInTouched:nil];
  355. }
  356. return YES;
  357. }
  358. - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  359. NSString *text = [textField.text stringByReplacingCharactersInRange:range withString:string];
  360. NSString *userID = [textField isEqual:_txtEmail] ? text : _txtEmail.text;
  361. NSString *userPW = [textField isEqual:_txtPasswd] ? text : _txtPasswd.text;
  362. _btnLogin.enabled = userID.length >= 6 && userPW.length >= 8;
  363. return YES;
  364. }
  365. //다음
  366. - (void)moveToNextField:(id)sender {
  367. [_txtPasswd becomeFirstResponder] ;
  368. }
  369. #pragma mark - SocketService
  370. - (void) socketDidReceiveMessage:(id)message result:(SocketModel *)result
  371. {
  372. SWITCH(result.messageType)
  373. {
  374. CASE (MSG_TYPE_LOGIN)
  375. {
  376. [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
  377. if (result.isSuccess) {
  378. LoginModel *loginInfo = (LoginModel *)message;
  379. [self actionForLoginSucceed:loginInfo];
  380. }
  381. else {
  382. [self loginErrorAlert:result];
  383. }
  384. break;
  385. }
  386. CASE (MSG_TYPE_AUTO_LOGIN)
  387. {
  388. [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
  389. if (result.isSuccess) {
  390. LoginModel *loginInfo = (LoginModel *)message;
  391. loginInfo.memberId = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  392. loginInfo.authToken = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_AUTOTOKEN];
  393. [self actionForLoginSucceed:loginInfo];
  394. }
  395. else {
  396. [self loginErrorAlert:result];
  397. }
  398. break;
  399. }
  400. CASE(@"auth.out")
  401. {
  402. if (result.isSuccess) {
  403. [self actionAfterLogout];
  404. }
  405. else {
  406. NSLog(@"Result Info : %@", result);
  407. }
  408. }
  409. DEFAULT
  410. {
  411. break;
  412. }
  413. }
  414. }
  415. - (void) loginErrorAlert:(SocketModel*)result {
  416. if (EQUALS(result.resultCode, @"102")) {
  417. [[JDFacade facade] confirmTitle:@"로그인 오류" message:@"로그인이 제한됩니다. 비밀번호 찾기 후 로그인 하세요." btnOKLabel:@"지금" btnCancelLabel:@"나중에" completion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
  418. if (buttonIndex == 0) {
  419. [self btnPwFindTouched:nil];
  420. }
  421. }];
  422. }
  423. else {
  424. [[JDFacade facade] alertTitle:@"알림" message:result.resultMsg];
  425. }
  426. }
  427. - (void) socketDidFailWithError:(NSError *)error {
  428. [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
  429. }
  430. #pragma mark - MemoryWarning
  431. - (void)didReceiveMemoryWarning
  432. {
  433. [super didReceiveMemoryWarning];
  434. // Dispose of any resources that can be recreated.
  435. }
  436. @end