Commit c7f22b37e4b4490dae5de627f01e17db7c924b64
1 parent
dd146a67
增加三方登录可选手机号,强制绑定手机号,校验验证码等接口
Showing
26 changed files
with
1228 additions
and
59 deletions
CNLiveUserSystemDemo.xcodeproj/project.pbxproj
| @@ -83,6 +83,10 @@ | @@ -83,6 +83,10 @@ | ||
| 83 | B6B54BEA1D8D009800089C9C /* UserInfoHeaderImageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BE91D8D009800089C9C /* UserInfoHeaderImageTableViewCell.m */; }; | 83 | B6B54BEA1D8D009800089C9C /* UserInfoHeaderImageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BE91D8D009800089C9C /* UserInfoHeaderImageTableViewCell.m */; }; |
| 84 | B6B54BED1D8D011000089C9C /* UserInfoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BEC1D8D011000089C9C /* UserInfoTableViewCell.m */; }; | 84 | B6B54BED1D8D011000089C9C /* UserInfoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BEC1D8D011000089C9C /* UserInfoTableViewCell.m */; }; |
| 85 | B6B54BF01D8D025A00089C9C /* ModifyUserInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */; }; | 85 | B6B54BF01D8D025A00089C9C /* ModifyUserInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */; }; |
| 86 | + D273A1DC1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m in Sources */ = {isa = PBXBuildFile; fileRef = D273A1DB1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m */; }; | ||
| 87 | + D273A1DF1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m in Sources */ = {isa = PBXBuildFile; fileRef = D273A1DE1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m */; }; | ||
| 88 | + D2D25B171ED94BCE00B4B18B /* EmailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2D25B161ED94BCE00B4B18B /* EmailViewController.m */; }; | ||
| 89 | + D2D25B1A1ED96DFD00B4B18B /* ModifyPwdViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2D25B191ED96DFD00B4B18B /* ModifyPwdViewController.m */; }; | ||
| 86 | /* End PBXBuildFile section */ | 90 | /* End PBXBuildFile section */ |
| 87 | 91 | ||
| 88 | /* Begin PBXContainerItemProxy section */ | 92 | /* Begin PBXContainerItemProxy section */ |
| @@ -251,6 +255,14 @@ | @@ -251,6 +255,14 @@ | ||
| 251 | B6B54BEC1D8D011000089C9C /* UserInfoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserInfoTableViewCell.m; sourceTree = "<group>"; }; | 255 | B6B54BEC1D8D011000089C9C /* UserInfoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserInfoTableViewCell.m; sourceTree = "<group>"; }; |
| 252 | B6B54BEE1D8D025A00089C9C /* ModifyUserInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifyUserInfoViewController.h; sourceTree = "<group>"; }; | 256 | B6B54BEE1D8D025A00089C9C /* ModifyUserInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifyUserInfoViewController.h; sourceTree = "<group>"; }; |
| 253 | B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModifyUserInfoViewController.m; sourceTree = "<group>"; }; | 257 | B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModifyUserInfoViewController.m; sourceTree = "<group>"; }; |
| 258 | + D273A1DA1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveEmailModifyPassword.h; sourceTree = "<group>"; }; | ||
| 259 | + D273A1DB1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveEmailModifyPassword.m; sourceTree = "<group>"; }; | ||
| 260 | + D273A1DD1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveCheckVerificationCode.h; sourceTree = "<group>"; }; | ||
| 261 | + D273A1DE1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveCheckVerificationCode.m; sourceTree = "<group>"; }; | ||
| 262 | + D2D25B151ED94BCE00B4B18B /* EmailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailViewController.h; sourceTree = "<group>"; }; | ||
| 263 | + D2D25B161ED94BCE00B4B18B /* EmailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailViewController.m; sourceTree = "<group>"; }; | ||
| 264 | + D2D25B181ED96DFD00B4B18B /* ModifyPwdViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifyPwdViewController.h; sourceTree = "<group>"; }; | ||
| 265 | + D2D25B191ED96DFD00B4B18B /* ModifyPwdViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModifyPwdViewController.m; sourceTree = "<group>"; }; | ||
| 254 | /* End PBXFileReference section */ | 266 | /* End PBXFileReference section */ |
| 255 | 267 | ||
| 256 | /* Begin PBXFrameworksBuildPhase section */ | 268 | /* Begin PBXFrameworksBuildPhase section */ |
| @@ -424,6 +436,10 @@ | @@ -424,6 +436,10 @@ | ||
| 424 | B6B54BE61D8CFEC200089C9C /* UserInfoViewController.m */, | 436 | B6B54BE61D8CFEC200089C9C /* UserInfoViewController.m */, |
| 425 | B6B54BEE1D8D025A00089C9C /* ModifyUserInfoViewController.h */, | 437 | B6B54BEE1D8D025A00089C9C /* ModifyUserInfoViewController.h */, |
| 426 | B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */, | 438 | B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */, |
| 439 | + D2D25B151ED94BCE00B4B18B /* EmailViewController.h */, | ||
| 440 | + D2D25B161ED94BCE00B4B18B /* EmailViewController.m */, | ||
| 441 | + D2D25B181ED96DFD00B4B18B /* ModifyPwdViewController.h */, | ||
| 442 | + D2D25B191ED96DFD00B4B18B /* ModifyPwdViewController.m */, | ||
| 427 | ); | 443 | ); |
| 428 | path = Conreollers; | 444 | path = Conreollers; |
| 429 | sourceTree = "<group>"; | 445 | sourceTree = "<group>"; |
| @@ -523,6 +539,10 @@ | @@ -523,6 +539,10 @@ | ||
| 523 | 811601001D92929A003CAE7D /* NSDictionary+Safety.m */, | 539 | 811601001D92929A003CAE7D /* NSDictionary+Safety.m */, |
| 524 | 812642FB1D86AFE600B402CA /* CNLiveUserSystemTypeDef.h */, | 540 | 812642FB1D86AFE600B402CA /* CNLiveUserSystemTypeDef.h */, |
| 525 | 818735211DA8FD2700046D84 /* Common.h */, | 541 | 818735211DA8FD2700046D84 /* Common.h */, |
| 542 | + D273A1DA1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.h */, | ||
| 543 | + D273A1DB1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m */, | ||
| 544 | + D273A1DD1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.h */, | ||
| 545 | + D273A1DE1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m */, | ||
| 526 | ); | 546 | ); |
| 527 | path = CNLiveUserSystemSDK; | 547 | path = CNLiveUserSystemSDK; |
| 528 | sourceTree = "<group>"; | 548 | sourceTree = "<group>"; |
| @@ -739,6 +759,7 @@ | @@ -739,6 +759,7 @@ | ||
| 739 | 8116F8E41D8916250084FE49 /* IdAndPwdView.m in Sources */, | 759 | 8116F8E41D8916250084FE49 /* IdAndPwdView.m in Sources */, |
| 740 | 8116F8EA1D89165A0084FE49 /* LoginViewController.m in Sources */, | 760 | 8116F8EA1D89165A0084FE49 /* LoginViewController.m in Sources */, |
| 741 | 812540FA1D87DDBE00F32D66 /* CNLiveFeedback.m in Sources */, | 761 | 812540FA1D87DDBE00F32D66 /* CNLiveFeedback.m in Sources */, |
| 762 | + D273A1DF1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m in Sources */, | ||
| 742 | 811600F81D927E7E003CAE7D /* UIImage+GIF.m in Sources */, | 763 | 811600F81D927E7E003CAE7D /* UIImage+GIF.m in Sources */, |
| 743 | 811600F61D927E7E003CAE7D /* SDWebImagePrefetcher.m in Sources */, | 764 | 811600F61D927E7E003CAE7D /* SDWebImagePrefetcher.m in Sources */, |
| 744 | 812642FA1D86A83100B402CA /* CNLiveUserSystemCenter.m in Sources */, | 765 | 812642FA1D86A83100B402CA /* CNLiveUserSystemCenter.m in Sources */, |
| @@ -750,6 +771,8 @@ | @@ -750,6 +771,8 @@ | ||
| 750 | 811600F21D927E7E003CAE7D /* SDWebImageDecoder.m in Sources */, | 771 | 811600F21D927E7E003CAE7D /* SDWebImageDecoder.m in Sources */, |
| 751 | 811600F51D927E7E003CAE7D /* SDWebImageManager.m in Sources */, | 772 | 811600F51D927E7E003CAE7D /* SDWebImageManager.m in Sources */, |
| 752 | 8187A8FB1D8E68CD007FAFB6 /* CNLiveLogout.m in Sources */, | 773 | 8187A8FB1D8E68CD007FAFB6 /* CNLiveLogout.m in Sources */, |
| 774 | + D273A1DC1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m in Sources */, | ||
| 775 | + D2D25B1A1ED96DFD00B4B18B /* ModifyPwdViewController.m in Sources */, | ||
| 753 | 81D0773E1D911D50000A5E00 /* CNLiveURLRequestSerialization.m in Sources */, | 776 | 81D0773E1D911D50000A5E00 /* CNLiveURLRequestSerialization.m in Sources */, |
| 754 | 8116F8EB1D89165A0084FE49 /* ViewController.m in Sources */, | 777 | 8116F8EB1D89165A0084FE49 /* ViewController.m in Sources */, |
| 755 | 8187A90E1D8E9A7B007FAFB6 /* SVProgressHUD.m in Sources */, | 778 | 8187A90E1D8E9A7B007FAFB6 /* SVProgressHUD.m in Sources */, |
| @@ -770,6 +793,7 @@ | @@ -770,6 +793,7 @@ | ||
| 770 | 811601011D92929A003CAE7D /* NSDictionary+Safety.m in Sources */, | 793 | 811601011D92929A003CAE7D /* NSDictionary+Safety.m in Sources */, |
| 771 | 811600FA1D927E7E003CAE7D /* UIImage+WebP.m in Sources */, | 794 | 811600FA1D927E7E003CAE7D /* UIImage+WebP.m in Sources */, |
| 772 | 812540FD1D87DFFB00F32D66 /* CNLiveUserInfo.m in Sources */, | 795 | 812540FD1D87DFFB00F32D66 /* CNLiveUserInfo.m in Sources */, |
| 796 | + D2D25B171ED94BCE00B4B18B /* EmailViewController.m in Sources */, | ||
| 773 | B6B54BF01D8D025A00089C9C /* ModifyUserInfoViewController.m in Sources */, | 797 | B6B54BF01D8D025A00089C9C /* ModifyUserInfoViewController.m in Sources */, |
| 774 | 81D077411D912079000A5E00 /* CNLiveUploadIcon.m in Sources */, | 798 | 81D077411D912079000A5E00 /* CNLiveUploadIcon.m in Sources */, |
| 775 | 8187A90F1D8E9A7B007FAFB6 /* SVRadialGradientLayer.m in Sources */, | 799 | 8187A90F1D8E9A7B007FAFB6 /* SVRadialGradientLayer.m in Sources */, |
| @@ -939,7 +963,7 @@ | @@ -939,7 +963,7 @@ | ||
| 939 | ); | 963 | ); |
| 940 | GCC_PREFIX_HEADER = "$(SRCROOT)/CNLiveUserSystemDemo/PrefixHeader.pch"; | 964 | GCC_PREFIX_HEADER = "$(SRCROOT)/CNLiveUserSystemDemo/PrefixHeader.pch"; |
| 941 | INFOPLIST_FILE = CNLiveUserSystemDemo/Info.plist; | 965 | INFOPLIST_FILE = CNLiveUserSystemDemo/Info.plist; |
| 942 | - IPHONEOS_DEPLOYMENT_TARGET = 10.0; | 966 | + IPHONEOS_DEPLOYMENT_TARGET = 8.0; |
| 943 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | 967 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; |
| 944 | LIBRARY_SEARCH_PATHS = ( | 968 | LIBRARY_SEARCH_PATHS = ( |
| 945 | "$(inherited)", | 969 | "$(inherited)", |
| @@ -972,7 +996,7 @@ | @@ -972,7 +996,7 @@ | ||
| 972 | ); | 996 | ); |
| 973 | GCC_PREFIX_HEADER = "$(SRCROOT)/CNLiveUserSystemDemo/PrefixHeader.pch"; | 997 | GCC_PREFIX_HEADER = "$(SRCROOT)/CNLiveUserSystemDemo/PrefixHeader.pch"; |
| 974 | INFOPLIST_FILE = CNLiveUserSystemDemo/Info.plist; | 998 | INFOPLIST_FILE = CNLiveUserSystemDemo/Info.plist; |
| 975 | - IPHONEOS_DEPLOYMENT_TARGET = 10.0; | 999 | + IPHONEOS_DEPLOYMENT_TARGET = 8.0; |
| 976 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | 1000 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; |
| 977 | LIBRARY_SEARCH_PATHS = ( | 1001 | LIBRARY_SEARCH_PATHS = ( |
| 978 | "$(inherited)", | 1002 | "$(inherited)", |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveCheckVerificationCode.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveCheckVerificationCode.h | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/26. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | +#import "CNLiveUserSystemTypeDef.h" | ||
| 11 | + | ||
| 12 | +@interface CNLiveCheckVerificationCode : NSObject | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + 注册前校验手机验证码 | ||
| 16 | + */ | ||
| 17 | +- (void)registerCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + 快捷登录前校验手机验证码 | ||
| 21 | + */ | ||
| 22 | +- (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 23 | +@end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveCheckVerificationCode.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveCheckVerificationCode.m | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/26. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveCheckVerificationCode.h" | ||
| 10 | +#import "CNLiveUserSystemTools.h" | ||
| 11 | +#import "CNLiveUserNetworkManager.h" | ||
| 12 | +#import "NSDictionary+Safety.h" | ||
| 13 | + | ||
| 14 | +//注册前校验手机验证码 | ||
| 15 | +static NSString *registerCheckVerificationCodeURL = @"https://api.cnlive.com/open/api2/user/checkVerifyCodeForUnRegistered"; | ||
| 16 | + | ||
| 17 | +//快捷登录前前校验手机验证码 | ||
| 18 | +static NSString *shortcutLoginCheckVerificationCodeURL = @"https://api.cnlive.com/open/api2/user/checkVerifyCode"; | ||
| 19 | + | ||
| 20 | +@implementation CNLiveCheckVerificationCode | ||
| 21 | + | ||
| 22 | +- (void)registerCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 23 | +{ | ||
| 24 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 25 | + @"mobile":[CNLiveUserSystemTools verify:mobile], | ||
| 26 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 27 | + @"clientPlat":@"i", | ||
| 28 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier | ||
| 29 | + }; | ||
| 30 | + | ||
| 31 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 32 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 33 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 34 | + | ||
| 35 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 36 | + [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +- (void)shortcutLoginCheckVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(CheckVerificationCodeType)type mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 40 | +{ | ||
| 41 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 42 | + @"mobile":[CNLiveUserSystemTools verify:mobile], | ||
| 43 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 44 | + @"clientPlat":@"i", | ||
| 45 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier | ||
| 46 | + }; | ||
| 47 | + | ||
| 48 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 49 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 50 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 51 | + | ||
| 52 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 53 | + [self requestWithURL:[self getURL:type] parameter:parameter success:success failure:failure]; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +#pragma mark - request | ||
| 57 | +- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 58 | +{ | ||
| 59 | + | ||
| 60 | + [[CNLiveUserNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | ||
| 61 | + | ||
| 62 | + responseObject = [responseObject validatedDictionary]; | ||
| 63 | + | ||
| 64 | + if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | ||
| 65 | + | ||
| 66 | + if (success) { | ||
| 67 | + success(responseObject); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + } else { | ||
| 71 | + | ||
| 72 | + if (failure) { | ||
| 73 | + failure(responseObject); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | ||
| 80 | + | ||
| 81 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; | ||
| 82 | + | ||
| 83 | + if (failure) { | ||
| 84 | + failure(errorDic); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + [CNLiveUserSystemTools errorStat:error.localizedDescription]; | ||
| 88 | + | ||
| 89 | + }]; | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +- (NSString *)getURL:(CheckVerificationCodeType)type | ||
| 93 | +{ | ||
| 94 | + NSString *url; | ||
| 95 | + switch (type) { | ||
| 96 | + case CheckVerificationCodeTypeShortcutLogin: | ||
| 97 | + url = shortcutLoginCheckVerificationCodeURL; | ||
| 98 | + break; | ||
| 99 | + case CheckVerificationCodeTypeRegister: | ||
| 100 | + url = registerCheckVerificationCodeURL; | ||
| 101 | + break; | ||
| 102 | + | ||
| 103 | + default: | ||
| 104 | + break; | ||
| 105 | + } | ||
| 106 | + return url; | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +@end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveEmailModifyPassword.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveEmailModifyPassword.h | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/26. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <Foundation/Foundation.h> | ||
| 10 | + | ||
| 11 | +@interface CNLiveEmailModifyPassword : NSObject | ||
| 12 | + | ||
| 13 | +- (void)modifyPwdWithAppId:(NSString *)appId appKey:(NSString *)appKey email:(NSString *)email newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 14 | + | ||
| 15 | +@end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveEmailModifyPassword.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveEmailModifyPassword.m | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/26. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveEmailModifyPassword.h" | ||
| 10 | +#import "CNLiveUserNetworkManager.h" | ||
| 11 | +#import "CNLiveUserSystemTools.h" | ||
| 12 | +#import "NSDictionary+Safety.h" | ||
| 13 | + | ||
| 14 | +//通过邮箱修改密码 | ||
| 15 | +static NSString *emailModifyPwdURL = @"https://api.cnlive.com/open/api2/user/updatePwdByEmail"; | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +@implementation CNLiveEmailModifyPassword | ||
| 19 | + | ||
| 20 | +- (void)modifyPwdWithAppId:(NSString *)appId appKey:(NSString *)appKey email:(NSString *)email newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 21 | +{ | ||
| 22 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 23 | + @"email":[CNLiveUserSystemTools verify:email], | ||
| 24 | + @"newPwd":[CNLiveUserSystemTools verify:newPwd], | ||
| 25 | + @"clientPlat":@"i", | ||
| 26 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier | ||
| 27 | + }; | ||
| 28 | + | ||
| 29 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 30 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 31 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 32 | + | ||
| 33 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 34 | + [self requestWithURL:emailModifyPwdURL parameter:parameter success:success failure:failure]; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +#pragma mark - request | ||
| 38 | +- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 39 | +{ | ||
| 40 | + | ||
| 41 | + [[CNLiveUserNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + responseObject = [responseObject validatedDictionary]; | ||
| 45 | + | ||
| 46 | + if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | ||
| 47 | + | ||
| 48 | + if (success) { | ||
| 49 | + success(responseObject); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } else { | ||
| 53 | + | ||
| 54 | + if (failure) { | ||
| 55 | + failure(responseObject); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | ||
| 62 | + | ||
| 63 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; | ||
| 64 | + | ||
| 65 | + if (failure) { | ||
| 66 | + failure(errorDic); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + [CNLiveUserSystemTools errorStat:error.localizedDescription]; | ||
| 70 | + | ||
| 71 | + }]; | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +@end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveLogin.h
| @@ -25,4 +25,13 @@ | @@ -25,4 +25,13 @@ | ||
| 25 | */ | 25 | */ |
| 26 | - (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 26 | - (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 27 | 27 | ||
| 28 | +/** | ||
| 29 | + * 验证第三方账号是否注册,若注册直接登录返回用户信息,若未注册返回errorCode | ||
| 30 | + */ | ||
| 31 | +- (void)thirdPartyCheckLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 32 | + | ||
| 33 | +/** | ||
| 34 | + * 第三方注册强制绑定手机号: 手机号+密码+验证码+三方账号 | ||
| 35 | + */ | ||
| 36 | +- (void)thirdPartyBindMobileLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode pawd:(NSString *)pawd frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 28 | @end | 37 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveLogin.m
| @@ -20,6 +20,13 @@ static NSString *loginURL = @"https://api.cnlive.com/open/api2/user/loginIn"; | @@ -20,6 +20,13 @@ static NSString *loginURL = @"https://api.cnlive.com/open/api2/user/loginIn"; | ||
| 20 | //第三方登录 | 20 | //第三方登录 |
| 21 | static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginIn3rd"; | 21 | static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginIn3rd"; |
| 22 | 22 | ||
| 23 | +//验证第三方账号是否注册,若注册则登录返回用户信息,若未注册则errorCode | ||
| 24 | +static NSString *thirdCheckLoginURL = @"https://api.cnlive.com/open/api2/user/loginIn3rdHasMobile4server"; | ||
| 25 | + | ||
| 26 | +//第三方注册强制绑定手机号: 手机号+密码+验证码+三方账号 | ||
| 27 | +static NSString *thirdBindMobileLoginURL = @"https://api.cnlive.com/open/api2/user/loginIn3rdAndBindMobile4server"; | ||
| 28 | + | ||
| 29 | + | ||
| 23 | @implementation CNLiveLogin | 30 | @implementation CNLiveLogin |
| 24 | 31 | ||
| 25 | - (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure | 32 | - (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| @@ -103,6 +110,55 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | @@ -103,6 +110,55 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | ||
| 103 | [self requestWithURL:loginURL parameter:parameter success:success failure:failure]; | 110 | [self requestWithURL:loginURL parameter:parameter success:success failure:failure]; |
| 104 | } | 111 | } |
| 105 | 112 | ||
| 113 | +/** | ||
| 114 | + * 验证第三方账号是否注册,若注册直接登录返回用户信息,若未注册返回errorCode | ||
| 115 | + */ | ||
| 116 | +- (void)thirdPartyCheckLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 117 | +{ | ||
| 118 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 119 | + @"thirdPartyPlat":[CNLiveUserSystemTools verify:plat], | ||
| 120 | + @"thirdPartyId":[CNLiveUserSystemTools verify:thirdPartyId], | ||
| 121 | + @"uuid":[CNLiveUserSystemTools uidForStat:[NSDate date]], | ||
| 122 | + @"frmId":[CNLiveUserSystemTools verify:frmId], | ||
| 123 | + @"clientPlat":@"i" | ||
| 124 | + }; | ||
| 125 | + | ||
| 126 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 127 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 128 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 129 | + | ||
| 130 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 131 | + [self requestWithURL:thirdCheckLoginURL parameter:parameter success:success failure:failure]; | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +/** | ||
| 135 | + * 第三方注册强制绑定手机号: 手机号+密码+验证码+三方账号 | ||
| 136 | + */ | ||
| 137 | +- (void)thirdPartyBindMobileLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode pawd:(NSString *)pawd frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 138 | +{ | ||
| 139 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 140 | + @"thirdPartyPlat":[CNLiveUserSystemTools verify:plat], | ||
| 141 | + @"thirdPartyId":[CNLiveUserSystemTools verify:thirdPartyId], | ||
| 142 | + @"nickName":[CNLiveUserSystemTools verify:nickName], | ||
| 143 | + @"gender":[CNLiveUserSystemTools verify:gender], | ||
| 144 | + @"location":[CNLiveUserSystemTools verify:location], | ||
| 145 | + @"faceUrl":[CNLiveUserSystemTools verify:faceUrl], | ||
| 146 | + @"uuid":[CNLiveUserSystemTools uidForStat:[NSDate date]], | ||
| 147 | +// @"frmId":[CNLiveUserSystemTools verify:frmId], | ||
| 148 | + @"mobile":[CNLiveUserSystemTools verify:mobile], | ||
| 149 | + @"verificationCode":[CNLiveUserSystemTools verify:verificationCode], | ||
| 150 | + @"pawd":[CNLiveUserSystemTools verify:pawd], | ||
| 151 | + @"clientPlat":@"i" | ||
| 152 | + }; | ||
| 153 | + | ||
| 154 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 155 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 156 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 157 | + | ||
| 158 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 159 | + [self requestWithURL:thirdBindMobileLoginURL parameter:parameter success:success failure:failure]; | ||
| 160 | +} | ||
| 161 | + | ||
| 106 | #pragma mark - request | 162 | #pragma mark - request |
| 107 | 163 | ||
| 108 | - (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 164 | - (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.h
| @@ -42,4 +42,9 @@ | @@ -42,4 +42,9 @@ | ||
| 42 | */ | 42 | */ |
| 43 | - (void)changePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | 43 | - (void)changePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 44 | 44 | ||
| 45 | +/** | ||
| 46 | + * 通过原密码修改密码 | ||
| 47 | + */ | ||
| 48 | +- (void)oldPwdChangePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid pwd:(NSString *)pwd newPwd:(NSString *)newPwd token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 49 | + | ||
| 45 | @end | 50 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.m
| @@ -32,6 +32,8 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/use | @@ -32,6 +32,8 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/use | ||
| 32 | //绑定第三方账号 | 32 | //绑定第三方账号 |
| 33 | static NSString *BindingThirdURL = @"https://api.cnlive.com/open/api2/user/bind3rd"; | 33 | static NSString *BindingThirdURL = @"https://api.cnlive.com/open/api2/user/bind3rd"; |
| 34 | 34 | ||
| 35 | +//通过原密码修改密码 | ||
| 36 | +static NSString *oldPwdUpdatePwdURL = @"https://api.cnlive.com/open/api2/user/updatePwd"; | ||
| 35 | 37 | ||
| 36 | @implementation CNLiveUserInfo | 38 | @implementation CNLiveUserInfo |
| 37 | 39 | ||
| @@ -220,6 +222,28 @@ static NSString *BindingThirdURL = @"https://api.cnlive.com/open/api2/use | @@ -220,6 +222,28 @@ static NSString *BindingThirdURL = @"https://api.cnlive.com/open/api2/use | ||
| 220 | 222 | ||
| 221 | } | 223 | } |
| 222 | 224 | ||
| 225 | +/** | ||
| 226 | + * 通过原密码修改密码 | ||
| 227 | + */ | ||
| 228 | +- (void)oldPwdChangePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid pwd:(NSString *)pwd newPwd:(NSString *)newPwd token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 229 | +{ | ||
| 230 | + NSDictionary *params = @{@"appId":[CNLiveUserSystemTools verify:appId], | ||
| 231 | + @"uid":[CNLiveUserSystemTools verify:uid], | ||
| 232 | + @"pwd":[CNLiveUserSystemTools verify:pwd], | ||
| 233 | + @"newPwd":[CNLiveUserSystemTools verify:newPwd], | ||
| 234 | + @"clientPlat":@"i", | ||
| 235 | + @"platform_id":[NSBundle mainBundle].bundleIdentifier, | ||
| 236 | + @"token":[CNLiveUserSystemTools verify:token] | ||
| 237 | + }; | ||
| 238 | + | ||
| 239 | + NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | ||
| 240 | + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | ||
| 241 | + NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | ||
| 242 | + | ||
| 243 | + [parameter setObject:signString forKey:@"sign"]; | ||
| 244 | + [self requestWithURL:oldPwdUpdatePwdURL parameter:parameter success:success failure:failure]; | ||
| 245 | +} | ||
| 246 | + | ||
| 223 | #pragma mark - request | 247 | #pragma mark - request |
| 224 | 248 | ||
| 225 | - (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | 249 | - (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.h
| @@ -178,8 +178,86 @@ | @@ -178,8 +178,86 @@ | ||
| 178 | 178 | ||
| 179 | 179 | ||
| 180 | /** | 180 | /** |
| 181 | + 通过邮箱修改密码 | ||
| 182 | + | ||
| 183 | + @param email 邮箱 | ||
| 184 | + @param newPwd 新密码 | ||
| 185 | + @param success 成功回调 | ||
| 186 | + @param failure 失败回调 | ||
| 187 | + */ | ||
| 188 | ++ (void)modifyPwdWithEmail:(NSString *)email newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 189 | + | ||
| 190 | + | ||
| 191 | +/** | ||
| 192 | + 通过原密码修改密码 | ||
| 193 | + | ||
| 194 | + @param uid 用户ID | ||
| 195 | + @param pwd 原密码 | ||
| 196 | + @param newPwd 新密码 | ||
| 197 | + @param success 成功回调 | ||
| 198 | + @param failure 失败回调 | ||
| 199 | + */ | ||
| 200 | ++ (void)oldPwdChangePasswordWithUid:(NSString *)uid pwd:(NSString *)pwd newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 201 | + | ||
| 202 | + | ||
| 203 | +/** | ||
| 204 | + 注册前校验手机验证码 | ||
| 205 | + | ||
| 206 | + @param mobile 手机号 | ||
| 207 | + @param verificationCode 验证码 | ||
| 208 | + @param success 成功回调 | ||
| 209 | + @param getVersion 失败回调 | ||
| 210 | + */ | ||
| 211 | ++ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 212 | + | ||
| 213 | + | ||
| 214 | +/** | ||
| 215 | + 快捷登录前校验手机验证码 | ||
| 216 | + | ||
| 217 | + @param mobile 手机号 | ||
| 218 | + @param verificationCode 验证码 | ||
| 219 | + @param success 成功回调 | ||
| 220 | + @param failure 失败回调 | ||
| 221 | + */ | ||
| 222 | ++ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 223 | + | ||
| 224 | + | ||
| 225 | +/** | ||
| 226 | + 验证第三方账号是否注册,若注册则直接登录返回用户信息,若未注册返回errorCode | ||
| 227 | + | ||
| 228 | + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | ||
| 229 | + @param thirdPartyId 第三方用户ID | ||
| 230 | + @param frmId 渠道ID(非必填) | ||
| 231 | + @param success 成功回调 | ||
| 232 | + @param failure 失败回调 | ||
| 233 | + */ | ||
| 234 | ++ (void)thirdPartyCheckLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 235 | + | ||
| 236 | + | ||
| 237 | +/** | ||
| 238 | + 第三方注册强制绑定手机号登录: 手机号+密码+验证码+三方账号 | ||
| 239 | + | ||
| 240 | + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | ||
| 241 | + @param thirdPartyId 第三方用户ID | ||
| 242 | + @param nickName 用户昵称 | ||
| 243 | + @param gender 性别,m:男、f:女、n:未知(非必填) | ||
| 244 | + @param location 用户所在地(非必填) | ||
| 245 | + @param faceUrl 头像,约100*100(非必填) | ||
| 246 | + @param mobile 手机号 | ||
| 247 | + @param verificationCode 验证码 (验证码类型为快捷登录VerificationCodeTypeShortcutLogin) | ||
| 248 | + @param pawd 注册密码 | ||
| 249 | + @param frmId 渠道ID(非必填) | ||
| 250 | + @param success 成功回调 | ||
| 251 | + @param failure 失败回调 | ||
| 252 | + */ | ||
| 253 | ++ (void)thirdPartyBindMobileLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode pawd:(NSString *)pawd frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | ||
| 254 | + | ||
| 255 | + | ||
| 256 | +/** | ||
| 181 | * 获取SDK版本号 | 257 | * 获取SDK版本号 |
| 182 | */ | 258 | */ |
| 183 | + (NSString *)getVersion; | 259 | + (NSString *)getVersion; |
| 184 | 260 | ||
| 261 | + | ||
| 262 | + | ||
| 185 | @end | 263 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.m
| @@ -15,6 +15,8 @@ | @@ -15,6 +15,8 @@ | ||
| 15 | #import "CNLiveUserSystemTools.h" | 15 | #import "CNLiveUserSystemTools.h" |
| 16 | #import "CNLiveUserManager.h" | 16 | #import "CNLiveUserManager.h" |
| 17 | #import "CNLiveUploadIcon.h" | 17 | #import "CNLiveUploadIcon.h" |
| 18 | +#import "CNLiveEmailModifyPassword.h" | ||
| 19 | +#import "CNLiveCheckVerificationCode.h" | ||
| 18 | #import "Common.h" | 20 | #import "Common.h" |
| 19 | 21 | ||
| 20 | @implementation CNLiveUserSystemCenter | 22 | @implementation CNLiveUserSystemCenter |
| @@ -170,6 +172,62 @@ | @@ -170,6 +172,62 @@ | ||
| 170 | } | 172 | } |
| 171 | 173 | ||
| 172 | /** | 174 | /** |
| 175 | + * 通过邮箱修改密码 | ||
| 176 | + */ | ||
| 177 | ++ (void)modifyPwdWithEmail:(NSString *)email newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 178 | +{ | ||
| 179 | + CNLiveEmailModifyPassword *emailModifyPwd = [[CNLiveEmailModifyPassword alloc] init]; | ||
| 180 | + [emailModifyPwd modifyPwdWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey email:email newPwd:newPwd success:success failure:failure]; | ||
| 181 | +} | ||
| 182 | + | ||
| 183 | +/** | ||
| 184 | + * 通过原密码修改密码 | ||
| 185 | + */ | ||
| 186 | ++ (void)oldPwdChangePasswordWithUid:(NSString *)uid pwd:(NSString *)pwd newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 187 | +{ | ||
| 188 | + CNLiveUserInfo *userInfo = [[CNLiveUserInfo alloc] init]; | ||
| 189 | + [userInfo oldPwdChangePasswordWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey uid:uid pwd:pwd newPwd:newPwd token:[[self class] getToken] success:success failure:failure]; | ||
| 190 | +} | ||
| 191 | + | ||
| 192 | +/** | ||
| 193 | + * 注册前校验手机验证码 | ||
| 194 | + */ | ||
| 195 | ++ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 196 | +{ | ||
| 197 | + CNLiveCheckVerificationCode *checkCode = [[CNLiveCheckVerificationCode alloc] init]; | ||
| 198 | + [checkCode registerCheckVerificationCodeWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey type:CheckVerificationCodeTypeRegister mobile:mobile verificationCode:verificationCode success:success failure:failure]; | ||
| 199 | +} | ||
| 200 | + | ||
| 201 | +/** | ||
| 202 | + * 快捷登录前校验手机验证码 | ||
| 203 | + */ | ||
| 204 | ++ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 205 | +{ | ||
| 206 | + CNLiveCheckVerificationCode *checkCode = [[CNLiveCheckVerificationCode alloc] init]; | ||
| 207 | + [checkCode shortcutLoginCheckVerificationCodeWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey type:CheckVerificationCodeTypeShortcutLogin mobile:mobile verificationCode:verificationCode success:success failure:failure]; | ||
| 208 | +} | ||
| 209 | + | ||
| 210 | +/** | ||
| 211 | + * 验证第三方账号是否注册,若注册直接登录返回用户信息,若未注册返回errorCode | ||
| 212 | + */ | ||
| 213 | ++ (void)thirdPartyCheckLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure | ||
| 214 | +{ | ||
| 215 | + CNLiveLogin *thirdLogin = [[CNLiveLogin alloc] init]; | ||
| 216 | + | ||
| 217 | + [thirdLogin thirdPartyCheckLoginWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey thirdPartyPlatType:plat thirdPartyId:thirdPartyId frmId:frmId success:success failure:failure]; | ||
| 218 | +} | ||
| 219 | + | ||
| 220 | +/** | ||
| 221 | + * 第三方注册强制绑定手机号: 手机号+密码+验证码+三方账号 | ||
| 222 | + */ | ||
| 223 | ++ (void)thirdPartyBindMobileLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode pawd:(NSString *)pawd frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure | ||
| 224 | +{ | ||
| 225 | + CNLiveLogin *thirdLogin = [[CNLiveLogin alloc] init]; | ||
| 226 | + | ||
| 227 | + [thirdLogin thirdPartyBindMobileLoginWithAppId:[CNLiveUserManager manager].appId appKey:[CNLiveUserManager manager].appKey thirdPartyPlatType:plat thirdPartyId:thirdPartyId nickName:nickName gender:gender location:location faceUrl:faceUrl mobile:mobile verificationCode:verificationCode pawd:pawd frmId:frmId success:success failure:failure]; | ||
| 228 | +} | ||
| 229 | + | ||
| 230 | +/** | ||
| 173 | * 获取版本号 | 231 | * 获取版本号 |
| 174 | */ | 232 | */ |
| 175 | + (NSString *)getVersion | 233 | + (NSString *)getVersion |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h
| @@ -24,4 +24,10 @@ typedef NS_ENUM(NSUInteger, UserInfoType) { | @@ -24,4 +24,10 @@ typedef NS_ENUM(NSUInteger, UserInfoType) { | ||
| 24 | UserInfoTypeLocation, //联系方式(地址) | 24 | UserInfoTypeLocation, //联系方式(地址) |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | +//校验验证码 | ||
| 28 | +typedef NS_ENUM(NSInteger, CheckVerificationCodeType) { | ||
| 29 | + CheckVerificationCodeTypeRegister = 0,//注册前校验验证码 | ||
| 30 | + CheckVerificationCodeTypeShortcutLogin //快捷登录前校验验证码 | ||
| 31 | +}; | ||
| 32 | + | ||
| 27 | #endif /* CNLiveUserSystemTypeDef_h */ | 33 | #endif /* CNLiveUserSystemTypeDef_h */ |
CNLiveUserSystemDemo/Conreollers/EmailViewController.h
0 → 100644
CNLiveUserSystemDemo/Conreollers/EmailViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// EmailViewController.m | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/27. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "EmailViewController.h" | ||
| 10 | + | ||
| 11 | +@interface EmailViewController () | ||
| 12 | + | ||
| 13 | +@property (nonatomic ,strong) UITextField * _Nullable emailTF; | ||
| 14 | +@property (nonatomic ,strong) UITextField * _Nullable pwdTF; | ||
| 15 | +@property (nonatomic, strong) UIButton * _Nullable confirmBtn; | ||
| 16 | + | ||
| 17 | +@end | ||
| 18 | + | ||
| 19 | +@implementation EmailViewController | ||
| 20 | + | ||
| 21 | +- (void)viewDidLoad { | ||
| 22 | + [super viewDidLoad]; | ||
| 23 | + // Do any additional setup after loading the view. | ||
| 24 | + self.view.backgroundColor = [UIColor whiteColor]; | ||
| 25 | + | ||
| 26 | + [self.view addSubview:self.emailTF]; | ||
| 27 | + [self.view addSubview:self.pwdTF]; | ||
| 28 | + [self.view addSubview:self.confirmBtn]; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +- (void)confirmBtnAction | ||
| 32 | +{ | ||
| 33 | + [CNLiveUserSystemCenter modifyPwdWithEmail:self.emailTF.text newPwd:self.pwdTF.text success:^(id result) { | ||
| 34 | + NSLog(@"result: %@",result); | ||
| 35 | + [Tools toast:result[@"errorMessage"]]; | ||
| 36 | + | ||
| 37 | + } failure:^(NSDictionary *errorDic) { | ||
| 38 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 39 | + }]; | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +- (UIButton *)confirmBtn | ||
| 43 | +{ | ||
| 44 | + if (!_confirmBtn) { | ||
| 45 | + _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 46 | + [_confirmBtn setFrame:CGRectMake(10, 280, KScreenWidth - 20, 40)]; | ||
| 47 | + [_confirmBtn setTitle:@"确 认" forState:UIControlStateNormal]; | ||
| 48 | + [_confirmBtn addTarget:self action:@selector(confirmBtnAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 49 | + _confirmBtn.titleLabel.font = [UIFont systemFontOfSize:18]; | ||
| 50 | + [_confirmBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 51 | + _confirmBtn.layer.cornerRadius = 20; | ||
| 52 | + _confirmBtn.layer.masksToBounds = YES; | ||
| 53 | + _confirmBtn.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 54 | + _confirmBtn.layer.borderWidth = 1; | ||
| 55 | + } | ||
| 56 | + return _confirmBtn; | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +- (UITextField *)emailTF | ||
| 60 | +{ | ||
| 61 | + if (!_emailTF) { | ||
| 62 | + _emailTF = [[UITextField alloc] initWithFrame:CGRectMake(10, 70, KScreenWidth - 20, 57)]; | ||
| 63 | + _emailTF.placeholder = @"请输入您的邮箱"; | ||
| 64 | + _emailTF.keyboardType = UIKeyboardTypeNamePhonePad; | ||
| 65 | + _emailTF.clearButtonMode = UITextFieldViewModeWhileEditing; | ||
| 66 | + _emailTF.font = [UIFont systemFontOfSize:17]; | ||
| 67 | + } | ||
| 68 | + return _emailTF; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +- (UITextField *)pwdTF | ||
| 72 | +{ | ||
| 73 | + if (!_pwdTF) { | ||
| 74 | + _pwdTF = [[UITextField alloc] initWithFrame:CGRectMake(10, 70 + 57, KScreenWidth - 20, 57)]; | ||
| 75 | + _pwdTF.placeholder = @"请输入您的新密码"; | ||
| 76 | + _pwdTF.clearButtonMode = UITextFieldViewModeWhileEditing; | ||
| 77 | + _pwdTF.keyboardType = UIKeyboardTypeNamePhonePad; | ||
| 78 | + _pwdTF.font = [UIFont systemFontOfSize:17]; | ||
| 79 | + } | ||
| 80 | + return _pwdTF; | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +- (void)didReceiveMemoryWarning { | ||
| 84 | + [super didReceiveMemoryWarning]; | ||
| 85 | + // Dispose of any resources that can be recreated. | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +/* | ||
| 89 | +#pragma mark - Navigation | ||
| 90 | + | ||
| 91 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 92 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 93 | + // Get the new view controller using [segue destinationViewController]. | ||
| 94 | + // Pass the selected object to the new view controller. | ||
| 95 | +} | ||
| 96 | +*/ | ||
| 97 | + | ||
| 98 | +@end |
CNLiveUserSystemDemo/Conreollers/LoginViewController.m
| @@ -24,6 +24,10 @@ | @@ -24,6 +24,10 @@ | ||
| 24 | @property (nonatomic, strong) UIButton *qqBtn; | 24 | @property (nonatomic, strong) UIButton *qqBtn; |
| 25 | @property (nonatomic, strong) UILabel *thirdpartyLoginLbl; | 25 | @property (nonatomic, strong) UILabel *thirdpartyLoginLbl; |
| 26 | 26 | ||
| 27 | +@property (nonatomic, strong) UIButton *checkThirdBtn; | ||
| 28 | +@property (nonatomic, strong) UIButton *bindMobileBtn; | ||
| 29 | +@property (nonatomic ,strong) UITextField *verificationCodeTF; | ||
| 30 | +@property (nonatomic ,strong) NSDictionary *dic; | ||
| 27 | @end | 31 | @end |
| 28 | 32 | ||
| 29 | @implementation LoginViewController | 33 | @implementation LoginViewController |
| @@ -44,33 +48,49 @@ | @@ -44,33 +48,49 @@ | ||
| 44 | [self.view addSubview:self.sinaBtn]; | 48 | [self.view addSubview:self.sinaBtn]; |
| 45 | [self.view addSubview:self.qqBtn]; | 49 | [self.view addSubview:self.qqBtn]; |
| 46 | [self.view addSubview:self.thirdpartyLoginLbl]; | 50 | [self.view addSubview:self.thirdpartyLoginLbl]; |
| 51 | + [self.view addSubview:self.checkThirdBtn]; | ||
| 52 | + [self.view addSubview:self.bindMobileBtn]; | ||
| 53 | + [self.view addSubview:self.verificationCodeTF]; | ||
| 47 | 54 | ||
| 48 | UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.registBtn]; | 55 | UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.registBtn]; |
| 49 | self.navigationItem.rightBarButtonItem = rightBarButtonItem; | 56 | self.navigationItem.rightBarButtonItem = rightBarButtonItem; |
| 50 | 57 | ||
| 51 | - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:ThirdLoginSuccess object:nil]; | 58 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess:) name:ThirdLoginSuccess object:nil]; |
| 52 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginFailure) name:ThirdLoginFailure object:nil]; | 59 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginFailure) name:ThirdLoginFailure object:nil]; |
| 53 | - | ||
| 54 | } | 60 | } |
| 55 | 61 | ||
| 56 | #pragma mark - action | 62 | #pragma mark - action |
| 57 | - (void)loginBtnAction | 63 | - (void)loginBtnAction |
| 58 | { | 64 | { |
| 59 | - [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear]; | ||
| 60 | - [SVProgressHUD show]; | ||
| 61 | - | ||
| 62 | - [CNLiveUserSystemCenter loginWithUserName:_idAndPwdView.idTF.text password:_idAndPwdView.pwdTF.text frmId:nil success:^(id result) { | ||
| 63 | - | ||
| 64 | - NSLog(@"登录 success------------%@",result); | ||
| 65 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 66 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 67 | - [Tools setUserLogin:YES]; | ||
| 68 | - [self.navigationController popViewControllerAnimated:YES]; | 65 | + NSDictionary *dic = self.dic; |
| 66 | + if (dic) {//三方强制绑定手机号登录 | ||
| 67 | + [CNLiveUserSystemCenter thirdPartyBindMobileLoginWithThirdPartyPlatType:[dic objectForKey:@"platType"] thirdPartyId:dic[@"partyId"] nickName:@"testNickName" gender:[dic objectForKey:@"gender"] location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"faceUrl"] mobile:[dic objectForKey:@"mobile"] verificationCode:self.verificationCodeTF.text pawd:_idAndPwdView.pwdTF.text frmId:@"" success:^(id result) { | ||
| 68 | + NSLog(@"BindMobile 登录------%@",result); | ||
| 69 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 70 | + [Tools setUserLogin:YES]; | ||
| 71 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 72 | + | ||
| 73 | + } failure:^(NSDictionary *errorDic) { | ||
| 74 | + NSLog(@"BindMobile 登录------%@",errorDic); | ||
| 75 | + }]; | ||
| 76 | + }else | ||
| 77 | + {//普通登录或三方验证登录 | ||
| 78 | + [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear]; | ||
| 79 | + [SVProgressHUD show]; | ||
| 69 | 80 | ||
| 70 | - } failure:^(NSDictionary *errorDic) { | ||
| 71 | - [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 72 | - [SVProgressHUD dismiss]; | ||
| 73 | - }]; | 81 | + [CNLiveUserSystemCenter loginWithUserName:_idAndPwdView.idTF.text password:_idAndPwdView.pwdTF.text frmId:nil success:^(id result) { |
| 82 | + | ||
| 83 | + NSLog(@"登录 success------------%@",result); | ||
| 84 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 85 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 86 | + [Tools setUserLogin:YES]; | ||
| 87 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 88 | + | ||
| 89 | + } failure:^(NSDictionary *errorDic) { | ||
| 90 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 91 | + [SVProgressHUD dismiss]; | ||
| 92 | + }]; | ||
| 93 | + } | ||
| 74 | } | 94 | } |
| 75 | 95 | ||
| 76 | - (void)messageLoginBtnAction | 96 | - (void)messageLoginBtnAction |
| @@ -102,9 +122,40 @@ | @@ -102,9 +122,40 @@ | ||
| 102 | [[CNLiveThirdLoginManager manager] qqLoginIsBindingThirdParty:NO]; | 122 | [[CNLiveThirdLoginManager manager] qqLoginIsBindingThirdParty:NO]; |
| 103 | } | 123 | } |
| 104 | 124 | ||
| 105 | -- (void)loginSuccess | 125 | +- (void)checkThirdBtnAction:(UIButton *)button |
| 126 | +{ | ||
| 127 | + button.selected = !button.selected; | ||
| 128 | + BOOL isCheck = NO; | ||
| 129 | + if (button.selected) { | ||
| 130 | + isCheck = YES; | ||
| 131 | + }else{ | ||
| 132 | + isCheck = NO; | ||
| 133 | + } | ||
| 134 | + [CNLiveThirdLoginManager manager].thirdType = ThirdLoginTypeCheckIsRegister; | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +- (void)bindMobileBtnAction:(UIButton *)button | ||
| 106 | { | 138 | { |
| 107 | - [self.navigationController popViewControllerAnimated:YES]; | 139 | + button.selected = !button.selected; |
| 140 | + BOOL isCheck = NO; | ||
| 141 | + if (button.selected) { | ||
| 142 | + isCheck = YES; | ||
| 143 | + }else{ | ||
| 144 | + isCheck = NO; | ||
| 145 | + } | ||
| 146 | + [CNLiveThirdLoginManager manager].thirdType = ThirdLoginTypeBindMobile; | ||
| 147 | + [CNLiveThirdLoginManager manager].bindMobile = _idAndPwdView.idTF.text; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +- (void)loginSuccess:(NSNotification *)noti | ||
| 151 | +{ | ||
| 152 | + if (noti.userInfo) | ||
| 153 | + {//强制绑定手机号 | ||
| 154 | + self.dic = noti.userInfo; | ||
| 155 | + }else | ||
| 156 | + {//普通三方登录和验证三方登录 | ||
| 157 | + [self.navigationController popViewControllerAnimated:YES]; | ||
| 158 | + } | ||
| 108 | } | 159 | } |
| 109 | 160 | ||
| 110 | - (void)loginFailure | 161 | - (void)loginFailure |
| @@ -121,6 +172,9 @@ | @@ -121,6 +172,9 @@ | ||
| 121 | if ([self.idAndPwdView.pwdTF isFirstResponder]) { | 172 | if ([self.idAndPwdView.pwdTF isFirstResponder]) { |
| 122 | [self.idAndPwdView.pwdTF resignFirstResponder]; | 173 | [self.idAndPwdView.pwdTF resignFirstResponder]; |
| 123 | } | 174 | } |
| 175 | + if ([self.verificationCodeTF isFirstResponder]) { | ||
| 176 | + [self.verificationCodeTF resignFirstResponder]; | ||
| 177 | + } | ||
| 124 | } | 178 | } |
| 125 | #pragma mark - getter | 179 | #pragma mark - getter |
| 126 | 180 | ||
| @@ -244,6 +298,54 @@ | @@ -244,6 +298,54 @@ | ||
| 244 | return _qqBtn; | 298 | return _qqBtn; |
| 245 | } | 299 | } |
| 246 | 300 | ||
| 301 | +- (UIButton *)checkThirdBtn | ||
| 302 | +{ | ||
| 303 | + if (!_checkThirdBtn) { | ||
| 304 | + _checkThirdBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 305 | + [_checkThirdBtn setFrame:CGRectMake(SpaceWidth, KScreenHeight-100, 150, 40)]; | ||
| 306 | + [_checkThirdBtn setTitle:@"三方登录" forState:UIControlStateNormal]; | ||
| 307 | + [_checkThirdBtn setTitle:@"三方验证并登录" forState:UIControlStateSelected]; | ||
| 308 | + [_checkThirdBtn addTarget:self action:@selector(checkThirdBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 309 | + _checkThirdBtn.titleLabel.font = [UIFont systemFontOfSize:18]; | ||
| 310 | + [_checkThirdBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 311 | + _checkThirdBtn.layer.cornerRadius = 20; | ||
| 312 | + _checkThirdBtn.layer.masksToBounds = YES; | ||
| 313 | + _checkThirdBtn.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 314 | + _checkThirdBtn.layer.borderWidth = 1; | ||
| 315 | + } | ||
| 316 | + return _checkThirdBtn; | ||
| 317 | +} | ||
| 318 | + | ||
| 319 | +- (UIButton *)bindMobileBtn | ||
| 320 | +{ | ||
| 321 | + if (!_bindMobileBtn) { | ||
| 322 | + _bindMobileBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 323 | + [_bindMobileBtn setFrame:CGRectMake(SpaceWidth, KScreenHeight-50, 180, 40)]; | ||
| 324 | + [_bindMobileBtn setTitle:@"三方登录" forState:UIControlStateNormal]; | ||
| 325 | + [_bindMobileBtn setTitle:@"三方绑定手机号登录" forState:UIControlStateSelected]; | ||
| 326 | + [_bindMobileBtn addTarget:self action:@selector(bindMobileBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 327 | + _bindMobileBtn.titleLabel.font = [UIFont systemFontOfSize:18]; | ||
| 328 | + [_bindMobileBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 329 | + _bindMobileBtn.layer.cornerRadius = 20; | ||
| 330 | + _bindMobileBtn.layer.masksToBounds = YES; | ||
| 331 | + _bindMobileBtn.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 332 | + _bindMobileBtn.layer.borderWidth = 1; | ||
| 333 | + } | ||
| 334 | + return _bindMobileBtn; | ||
| 335 | +} | ||
| 336 | + | ||
| 337 | +- (UITextField *)verificationCodeTF | ||
| 338 | +{ | ||
| 339 | + if (!_verificationCodeTF) { | ||
| 340 | + _verificationCodeTF = [[UITextField alloc] initWithFrame:CGRectMake(SpaceWidth + 200, KScreenHeight-50, self.view.bounds.size.width - SpaceWidth - 200, 40)]; | ||
| 341 | + _verificationCodeTF.font = [UIFont systemFontOfSize:17]; | ||
| 342 | + _verificationCodeTF.keyboardType = UIKeyboardTypeNumberPad; | ||
| 343 | + _verificationCodeTF.placeholder = @"请输入验证码"; | ||
| 344 | + _verificationCodeTF.returnKeyType = UIReturnKeyDone; | ||
| 345 | + } | ||
| 346 | + return _verificationCodeTF; | ||
| 347 | +} | ||
| 348 | + | ||
| 247 | - (void)didReceiveMemoryWarning { | 349 | - (void)didReceiveMemoryWarning { |
| 248 | [super didReceiveMemoryWarning]; | 350 | [super didReceiveMemoryWarning]; |
| 249 | // Dispose of any resources that can be recreated. | 351 | // Dispose of any resources that can be recreated. |
CNLiveUserSystemDemo/Conreollers/ModifyPwdViewController.h
0 → 100644
| 1 | +// | ||
| 2 | +// ModifyPwdViewController.h | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/27. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +typedef NS_ENUM(NSInteger, ModifyPwdType) {//枚举类型 | ||
| 12 | + ModifyPwdTypeEmail = 1,//通过邮箱修改密码 | ||
| 13 | + ModifyPwdTypeOldPwd //通过原密码修改密码 | ||
| 14 | +}; | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +@interface ModifyPwdViewController : UIViewController | ||
| 18 | + | ||
| 19 | +@property (nonatomic ,assign) ModifyPwdType type; | ||
| 20 | +@end |
CNLiveUserSystemDemo/Conreollers/ModifyPwdViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// ModifyPwdViewController.m | ||
| 3 | +// CNLiveUserSystemDemo | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/5/27. | ||
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "ModifyPwdViewController.h" | ||
| 10 | + | ||
| 11 | +@interface ModifyPwdViewController () | ||
| 12 | + | ||
| 13 | +@property (nonatomic ,strong) UITextField * _Nullable emailTF; | ||
| 14 | +@property (nonatomic ,strong) UITextField * _Nullable pwdTF; | ||
| 15 | +@property (nonatomic, strong) UIButton * _Nullable confirmBtn; | ||
| 16 | + | ||
| 17 | +@end | ||
| 18 | + | ||
| 19 | +@implementation ModifyPwdViewController | ||
| 20 | + | ||
| 21 | +- (void)viewDidLoad { | ||
| 22 | + [super viewDidLoad]; | ||
| 23 | + // Do any additional setup after loading the view. | ||
| 24 | + | ||
| 25 | + self.view.backgroundColor = [UIColor whiteColor]; | ||
| 26 | + | ||
| 27 | + [self.view addSubview:self.emailTF]; | ||
| 28 | + [self.view addSubview:self.pwdTF]; | ||
| 29 | + [self.view addSubview:self.confirmBtn]; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +- (void)confirmBtnAction | ||
| 34 | +{ | ||
| 35 | + if (self.type == ModifyPwdTypeEmail) { | ||
| 36 | + [CNLiveUserSystemCenter modifyPwdWithEmail:self.emailTF.text newPwd:self.pwdTF.text success:^(id result) { | ||
| 37 | + | ||
| 38 | + [Tools toast:result[@"errorMessage"]]; | ||
| 39 | + | ||
| 40 | + } failure:^(NSDictionary *errorDic) { | ||
| 41 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 42 | + }]; | ||
| 43 | + | ||
| 44 | + }else if (self.type == ModifyPwdTypeOldPwd){ | ||
| 45 | + UserInfoModel *model = [UserInfoModel modelWithKeyValues:[Tools getLocalUserInfo]]; | ||
| 46 | + [CNLiveUserSystemCenter oldPwdChangePasswordWithUid:model.uid pwd:self.emailTF.text newPwd:self.pwdTF.text success:^(id result) { | ||
| 47 | + | ||
| 48 | + [Tools toast:result[@"errorMessage"]]; | ||
| 49 | + } failure:^(NSDictionary *errorDic) { | ||
| 50 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 51 | + }]; | ||
| 52 | + | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +- (UIButton *)confirmBtn | ||
| 59 | +{ | ||
| 60 | + if (!_confirmBtn) { | ||
| 61 | + _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 62 | + [_confirmBtn setFrame:CGRectMake(10, 280, KScreenWidth - 20, 40)]; | ||
| 63 | + [_confirmBtn setTitle:@"确 认" forState:UIControlStateNormal]; | ||
| 64 | + [_confirmBtn addTarget:self action:@selector(confirmBtnAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 65 | + _confirmBtn.titleLabel.font = [UIFont systemFontOfSize:18]; | ||
| 66 | + [_confirmBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 67 | + _confirmBtn.layer.cornerRadius = 20; | ||
| 68 | + _confirmBtn.layer.masksToBounds = YES; | ||
| 69 | + _confirmBtn.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 70 | + _confirmBtn.layer.borderWidth = 1; | ||
| 71 | + } | ||
| 72 | + return _confirmBtn; | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +- (UITextField *)emailTF | ||
| 76 | +{ | ||
| 77 | + if (!_emailTF) { | ||
| 78 | + _emailTF = [[UITextField alloc] initWithFrame:CGRectMake(10, 70, KScreenWidth - 20, 57)]; | ||
| 79 | + if (self.type == ModifyPwdTypeEmail) { | ||
| 80 | + _emailTF.placeholder = @"请输入您的邮箱"; | ||
| 81 | + }else if (self.type == ModifyPwdTypeOldPwd){ | ||
| 82 | + _emailTF.placeholder = @"请输入您的旧密码"; | ||
| 83 | + } | ||
| 84 | + _emailTF.keyboardType = UIKeyboardTypeNamePhonePad; | ||
| 85 | + _emailTF.clearButtonMode = UITextFieldViewModeWhileEditing; | ||
| 86 | + _emailTF.font = [UIFont systemFontOfSize:17]; | ||
| 87 | + } | ||
| 88 | + return _emailTF; | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +- (UITextField *)pwdTF | ||
| 92 | +{ | ||
| 93 | + if (!_pwdTF) { | ||
| 94 | + _pwdTF = [[UITextField alloc] initWithFrame:CGRectMake(10, 70 + 57, KScreenWidth - 20, 57)]; | ||
| 95 | + _pwdTF.placeholder = @"请输入您的新密码"; | ||
| 96 | + _pwdTF.clearButtonMode = UITextFieldViewModeWhileEditing; | ||
| 97 | + _pwdTF.keyboardType = UIKeyboardTypeNamePhonePad; | ||
| 98 | + _pwdTF.font = [UIFont systemFontOfSize:17]; | ||
| 99 | + } | ||
| 100 | + return _pwdTF; | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | + | ||
| 104 | +- (void)didReceiveMemoryWarning { | ||
| 105 | + [super didReceiveMemoryWarning]; | ||
| 106 | + // Dispose of any resources that can be recreated. | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +/* | ||
| 110 | +#pragma mark - Navigation | ||
| 111 | + | ||
| 112 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 113 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 114 | + // Get the new view controller using [segue destinationViewController]. | ||
| 115 | + // Pass the selected object to the new view controller. | ||
| 116 | +} | ||
| 117 | +*/ | ||
| 118 | + | ||
| 119 | +@end |
CNLiveUserSystemDemo/Conreollers/RegisterViewController.m
| @@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
| 15 | @property (nonatomic, strong) UIButton *verificationBtn; | 15 | @property (nonatomic, strong) UIButton *verificationBtn; |
| 16 | @property (nonatomic, strong) UIButton *loginBtn; | 16 | @property (nonatomic, strong) UIButton *loginBtn; |
| 17 | @property (nonatomic, strong) dispatch_source_t timer; | 17 | @property (nonatomic, strong) dispatch_source_t timer; |
| 18 | +@property (nonatomic, strong) UIButton *checkCodeBtn; | ||
| 18 | 19 | ||
| 19 | @end | 20 | @end |
| 20 | 21 | ||
| @@ -39,7 +40,9 @@ | @@ -39,7 +40,9 @@ | ||
| 39 | [self.view addSubview:self.registBasicInformationView]; | 40 | [self.view addSubview:self.registBasicInformationView]; |
| 40 | [self.view addSubview:self.verificationBtn]; | 41 | [self.view addSubview:self.verificationBtn]; |
| 41 | [self.view addSubview:self.loginBtn]; | 42 | [self.view addSubview:self.loginBtn]; |
| 42 | - | 43 | + if ([_type isEqualToString:@"register"] || [_type isEqualToString:@"quicklyLogin"]) { |
| 44 | + [self.view addSubview:self.checkCodeBtn]; | ||
| 45 | + } | ||
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | #pragma mark - action | 48 | #pragma mark - action |
| @@ -87,6 +90,15 @@ | @@ -87,6 +90,15 @@ | ||
| 87 | } | 90 | } |
| 88 | } | 91 | } |
| 89 | 92 | ||
| 93 | +- (void)checkCodeBtnAction | ||
| 94 | +{ | ||
| 95 | + [CNLiveUserSystemCenter shortcutLoginCheckVerificationCodeWithMobile:_registBasicInformationView.phoneTF.text verificationCode:_registBasicInformationView.verificationTF.text success:^(id result) { | ||
| 96 | + [Tools toast:result[@"errorMessage"]]; | ||
| 97 | + } failure:^(NSDictionary *errorDic) { | ||
| 98 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 99 | + }]; | ||
| 100 | +} | ||
| 101 | + | ||
| 90 | - (void)stopTimer | 102 | - (void)stopTimer |
| 91 | { | 103 | { |
| 92 | [self.verificationBtn setTitle:@"发送验证码" forState:UIControlStateNormal]; | 104 | [self.verificationBtn setTitle:@"发送验证码" forState:UIControlStateNormal]; |
| @@ -213,6 +225,24 @@ | @@ -213,6 +225,24 @@ | ||
| 213 | return _registBasicInformationView; | 225 | return _registBasicInformationView; |
| 214 | } | 226 | } |
| 215 | 227 | ||
| 228 | +- (UIButton *)checkCodeBtn | ||
| 229 | +{ | ||
| 230 | + if (!_checkCodeBtn) { | ||
| 231 | + _checkCodeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 232 | + [_checkCodeBtn setFrame:CGRectMake(KScreenWidth - 105, 80 + 57, 95, 37)]; | ||
| 233 | + [_checkCodeBtn setTitle:@"校验验证码" forState:UIControlStateNormal]; | ||
| 234 | + [_checkCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | ||
| 235 | + [_checkCodeBtn addTarget:self action:@selector(checkCodeBtnAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 236 | + _checkCodeBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | ||
| 237 | + [_checkCodeBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 238 | + _checkCodeBtn.layer.cornerRadius = 10; | ||
| 239 | + _checkCodeBtn.layer.masksToBounds = YES; | ||
| 240 | + _checkCodeBtn.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 241 | + _checkCodeBtn.layer.borderWidth = 1; | ||
| 242 | + } | ||
| 243 | + return _checkCodeBtn; | ||
| 244 | +} | ||
| 245 | + | ||
| 216 | - (UIButton *)verificationBtn | 246 | - (UIButton *)verificationBtn |
| 217 | { | 247 | { |
| 218 | if (!_verificationBtn) { | 248 | if (!_verificationBtn) { |
CNLiveUserSystemDemo/Conreollers/ViewController.m
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | #import "UserInfoSava.h" | 14 | #import "UserInfoSava.h" |
| 15 | #import "ThirdPartyView.h" | 15 | #import "ThirdPartyView.h" |
| 16 | #import "CNLiveThirdLoginManager.h" | 16 | #import "CNLiveThirdLoginManager.h" |
| 17 | +#import "ModifyPwdViewController.h" | ||
| 17 | 18 | ||
| 18 | @interface ViewController ()<UITableViewDelegate,UITableViewDataSource,ThirdPartyViewDelegate,UIGestureRecognizerDelegate> | 19 | @interface ViewController ()<UITableViewDelegate,UITableViewDataSource,ThirdPartyViewDelegate,UIGestureRecognizerDelegate> |
| 19 | { | 20 | { |
| @@ -47,7 +48,7 @@ | @@ -47,7 +48,7 @@ | ||
| 47 | [self.view addSubview:self.loginBtn]; | 48 | [self.view addSubview:self.loginBtn]; |
| 48 | [self.view addSubview:self.thirPartydView]; | 49 | [self.view addSubview:self.thirPartydView]; |
| 49 | 50 | ||
| 50 | - _dataArr = @[@"通过手机号修改密码",@"更新附加信息",@"修改用户信息",@"查询用户信息",@"查询多条用户信息",@"反馈",@"绑定第三方账号"]; | 51 | + _dataArr = @[@"通过手机号修改密码",@"更新附加信息",@"修改用户信息",@"查询用户信息",@"查询多条用户信息",@"反馈",@"绑定第三方账号",@"通过邮箱修改密码",@"通过原密码修改密码"]; |
| 51 | 52 | ||
| 52 | } | 53 | } |
| 53 | 54 | ||
| @@ -234,6 +235,18 @@ | @@ -234,6 +235,18 @@ | ||
| 234 | _thirPartydView.frame = CGRectMake(0, KScreenHeight-160, KScreenWidth, 160); | 235 | _thirPartydView.frame = CGRectMake(0, KScreenHeight-160, KScreenWidth, 160); |
| 235 | }]; | 236 | }]; |
| 236 | } | 237 | } |
| 238 | + | ||
| 239 | + if (indexPath.row == 8) { //邮箱修改密码 | ||
| 240 | + ModifyPwdViewController *modVC = [[ModifyPwdViewController alloc] init]; | ||
| 241 | + modVC.type = ModifyPwdTypeEmail; | ||
| 242 | + [self.navigationController pushViewController:modVC animated:YES]; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + if (indexPath.row == 9) { //原密码修改密码 | ||
| 246 | + ModifyPwdViewController *modVC = [[ModifyPwdViewController alloc] init]; | ||
| 247 | + modVC.type = ModifyPwdTypeOldPwd; | ||
| 248 | + [self.navigationController pushViewController:modVC animated:YES]; | ||
| 249 | + } | ||
| 237 | } | 250 | } |
| 238 | 251 | ||
| 239 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | 252 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath |
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.h
| @@ -8,6 +8,13 @@ | @@ -8,6 +8,13 @@ | ||
| 8 | 8 | ||
| 9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
| 10 | 10 | ||
| 11 | +typedef NS_ENUM(NSInteger, ThirdLoginType) {//枚举类型 | ||
| 12 | + ThirdLoginTypeCommon = 0,//普通三方登录 | ||
| 13 | + ThirdLoginTypeCheckIsRegister ,//验证三方是否注册,注册过登录 | ||
| 14 | + ThirdLoginTypeBindMobile //强制绑定手机号三方登录 | ||
| 15 | +}; | ||
| 16 | + | ||
| 17 | + | ||
| 11 | @interface CNLiveThirdLoginManager : NSObject | 18 | @interface CNLiveThirdLoginManager : NSObject |
| 12 | 19 | ||
| 13 | + (CNLiveThirdLoginManager *)manager; | 20 | + (CNLiveThirdLoginManager *)manager; |
| @@ -20,4 +27,7 @@ | @@ -20,4 +27,7 @@ | ||
| 20 | 27 | ||
| 21 | - (void)sinaLoginIsBindingThirdParty:(BOOL)Binding; | 28 | - (void)sinaLoginIsBindingThirdParty:(BOOL)Binding; |
| 22 | 29 | ||
| 30 | +@property (nonatomic ,assign) ThirdLoginType thirdType; | ||
| 31 | +@property (nonatomic ,copy) NSString * bindMobile; | ||
| 32 | + | ||
| 23 | @end | 33 | @end |
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.m
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | #import <TencentOpenAPI/QQApiInterfaceObject.h> | 11 | #import <TencentOpenAPI/QQApiInterfaceObject.h> |
| 12 | #import <TencentOpenAPI/QQApiInterface.h> | 12 | #import <TencentOpenAPI/QQApiInterface.h> |
| 13 | 13 | ||
| 14 | -#define verificationCode @"cnlive" | 14 | +#define VerificationCode @"cnlive" |
| 15 | 15 | ||
| 16 | @interface CNLiveThirdLoginManager ()<WXApiDelegate,TencentSessionDelegate,TencentLoginDelegate,WBHttpRequestDelegate,WeiboSDKDelegate> | 16 | @interface CNLiveThirdLoginManager ()<WXApiDelegate,TencentSessionDelegate,TencentLoginDelegate,WBHttpRequestDelegate,WeiboSDKDelegate> |
| 17 | { | 17 | { |
| @@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
| 88 | if ([WXApi isWXAppInstalled]) { | 88 | if ([WXApi isWXAppInstalled]) { |
| 89 | SendAuthReq* req = [[SendAuthReq alloc] init]; | 89 | SendAuthReq* req = [[SendAuthReq alloc] init]; |
| 90 | req.scope = @"snsapi_userinfo"; | 90 | req.scope = @"snsapi_userinfo"; |
| 91 | - req.state = verificationCode; | 91 | + req.state = VerificationCode; |
| 92 | [WXApi sendReq:req]; | 92 | [WXApi sendReq:req]; |
| 93 | } | 93 | } |
| 94 | else { | 94 | else { |
| @@ -150,17 +150,57 @@ | @@ -150,17 +150,57 @@ | ||
| 150 | gender = @"n"; | 150 | gender = @"n"; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] nickName:[result objectForKey:@"nickname"] gender:gender location:[result objectForKey:@"city"] faceUrl:[result objectForKey:@"figureurl"] frmId:nil success:^(id result) { | ||
| 154 | - NSLog(@"qq登录------%@",result); | ||
| 155 | - | ||
| 156 | - [Tools setUserLogin:YES]; | ||
| 157 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 158 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 159 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 160 | - | ||
| 161 | - } failure:^(NSDictionary *errorDic) { | ||
| 162 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 163 | - }]; | 153 | + switch (self.thirdType) { |
| 154 | + case ThirdLoginTypeCommon: | ||
| 155 | + { | ||
| 156 | + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] nickName:[result objectForKey:@"nickname"] gender:gender location:[result objectForKey:@"city"] faceUrl:[result objectForKey:@"figureurl"] frmId:nil success:^(id result) { | ||
| 157 | + NSLog(@"三方qq登录------%@",result); | ||
| 158 | + | ||
| 159 | + [Tools setUserLogin:YES]; | ||
| 160 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 161 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 162 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 163 | + | ||
| 164 | + } failure:^(NSDictionary *errorDic) { | ||
| 165 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 166 | + }]; | ||
| 167 | + } | ||
| 168 | + break; | ||
| 169 | + case ThirdLoginTypeCheckIsRegister: | ||
| 170 | + { | ||
| 171 | + [CNLiveUserSystemCenter thirdPartyCheckLoginWithThirdPartyPlatType:@"2" thirdPartyId:[tencentOAuth getUserOpenID] frmId:@"" success:^(id result) { | ||
| 172 | + NSLog(@"验证三方qq登录------%@",result); | ||
| 173 | + [Tools setUserLogin:YES]; | ||
| 174 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 175 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 176 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 177 | + | ||
| 178 | + } failure:^(NSDictionary *errorDic) { | ||
| 179 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 180 | + }]; | ||
| 181 | + } | ||
| 182 | + break; | ||
| 183 | + case ThirdLoginTypeBindMobile: | ||
| 184 | + { | ||
| 185 | + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:self.bindMobile success:^(id result) { | ||
| 186 | + NSLog(@"ver %@",result); | ||
| 187 | + if ([result[@"errorCode"] isEqualToString:@"0"]) { | ||
| 188 | + | ||
| 189 | + NSString *location = [response.jsonResponse objectForKey:@"city"]; | ||
| 190 | + NSString *teId = [tencentOAuth getUserOpenID]; | ||
| 191 | + NSString *faceUrl = [response.jsonResponse objectForKey:@"figureurl_qq_2"]; | ||
| 192 | + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:teId,@"partyId",gender,@"gender",location,@"location",faceUrl,@"faceUrl",@"2",@"platType",self.bindMobile,@"mobile", nil]; | ||
| 193 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:dic]; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + } failure:^(NSDictionary *errorDic) { | ||
| 197 | + NSLog(@"%@",errorDic); | ||
| 198 | + }]; | ||
| 199 | + } | ||
| 200 | + break; | ||
| 201 | + default: | ||
| 202 | + break; | ||
| 203 | + } | ||
| 164 | } | 204 | } |
| 165 | } | 205 | } |
| 166 | 206 | ||
| @@ -197,8 +237,6 @@ | @@ -197,8 +237,6 @@ | ||
| 197 | 237 | ||
| 198 | [self getWeChatUserInfo:authResp]; | 238 | [self getWeChatUserInfo:authResp]; |
| 199 | 239 | ||
| 200 | -// } | ||
| 201 | - | ||
| 202 | } | 240 | } |
| 203 | else if (temp.errCode == -4) { | 241 | else if (temp.errCode == -4) { |
| 204 | // 用户拒绝授权 | 242 | // 用户拒绝授权 |
| @@ -285,17 +323,58 @@ | @@ -285,17 +323,58 @@ | ||
| 285 | break; | 323 | break; |
| 286 | } | 324 | } |
| 287 | 325 | ||
| 288 | - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] nickName:[dic objectForKey:@"nickname"] gender:gender location:[dic objectForKey:@"country"] faceUrl:[dic objectForKey:@"headimgurl"] frmId:nil success:^(id result) { | ||
| 289 | - NSLog(@"微信登录------%@",result); | ||
| 290 | - | ||
| 291 | - [Tools setUserLogin:YES]; | ||
| 292 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 293 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 294 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 295 | - | ||
| 296 | - } failure:^(NSDictionary *errorDic) { | ||
| 297 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 298 | - }]; | 326 | + switch (self.thirdType) { |
| 327 | + case ThirdLoginTypeCommon: | ||
| 328 | + { | ||
| 329 | + | ||
| 330 | + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] nickName:[dic objectForKey:@"nickname"] gender:gender location:[dic objectForKey:@"country"] faceUrl:[dic objectForKey:@"headimgurl"] frmId:nil success:^(id result) { | ||
| 331 | + NSLog(@"微信登录------%@",result); | ||
| 332 | + | ||
| 333 | + [Tools setUserLogin:YES]; | ||
| 334 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 335 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 336 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 337 | + | ||
| 338 | + } failure:^(NSDictionary *errorDic) { | ||
| 339 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 340 | + }]; | ||
| 341 | + } | ||
| 342 | + break; | ||
| 343 | + case ThirdLoginTypeCheckIsRegister: | ||
| 344 | + { | ||
| 345 | + [CNLiveUserSystemCenter thirdPartyCheckLoginWithThirdPartyPlatType:@"3" thirdPartyId:[dic objectForKey:@"openid"] frmId:@"" success:^(id result) { | ||
| 346 | + NSLog(@"验证三方微信登录------%@",result); | ||
| 347 | + [Tools setUserLogin:YES]; | ||
| 348 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 349 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 350 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 351 | + | ||
| 352 | + } failure:^(NSDictionary *errorDic) { | ||
| 353 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 354 | + }]; | ||
| 355 | + } | ||
| 356 | + break; | ||
| 357 | + case ThirdLoginTypeBindMobile: | ||
| 358 | + { | ||
| 359 | + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:self.bindMobile success:^(id result) { | ||
| 360 | + NSLog(@"ver %@",result); | ||
| 361 | + if ([result[@"errorCode"] isEqualToString:@"0"]) { | ||
| 362 | + | ||
| 363 | + NSString *location = [dic objectForKey:@"country"]; | ||
| 364 | + NSString *teId = [dic objectForKey:@"openid"]; | ||
| 365 | + NSString *faceUrl = [dic objectForKey:@"headimgurl"]; | ||
| 366 | + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:teId,@"partyId",gender,@"gender",location,@"location",faceUrl,@"faceUrl",@"3",@"platType",self.bindMobile,@"mobile", nil]; | ||
| 367 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:dic]; | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + } failure:^(NSDictionary *errorDic) { | ||
| 371 | + NSLog(@"%@",errorDic); | ||
| 372 | + }]; | ||
| 373 | + } | ||
| 374 | + break; | ||
| 375 | + default: | ||
| 376 | + break; | ||
| 377 | + } | ||
| 299 | } | 378 | } |
| 300 | } | 379 | } |
| 301 | } | 380 | } |
| @@ -354,17 +433,57 @@ | @@ -354,17 +433,57 @@ | ||
| 354 | gender = @"n"; | 433 | gender = @"n"; |
| 355 | } | 434 | } |
| 356 | 435 | ||
| 357 | - [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] nickName:[dic objectForKey:@"name"] gender:gender location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"avatar_hd"] frmId:nil success:^(id result) { | ||
| 358 | - NSLog(@"微博登录------%@",result); | ||
| 359 | - | ||
| 360 | - [Tools setUserLogin:YES]; | ||
| 361 | - [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 362 | - [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 363 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 364 | - | ||
| 365 | - } failure:^(NSDictionary *errorDic) { | ||
| 366 | - [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 367 | - }]; | 436 | + switch (self.thirdType) { |
| 437 | + case ThirdLoginTypeCommon: | ||
| 438 | + { | ||
| 439 | + [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] nickName:[dic objectForKey:@"name"] gender:gender location:[dic objectForKey:@"location"] faceUrl:[dic objectForKey:@"avatar_hd"] frmId:nil success:^(id result) { | ||
| 440 | + NSLog(@"微博登录------%@",result); | ||
| 441 | + | ||
| 442 | + [Tools setUserLogin:YES]; | ||
| 443 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 444 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 445 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 446 | + | ||
| 447 | + } failure:^(NSDictionary *errorDic) { | ||
| 448 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 449 | + }]; | ||
| 450 | + } | ||
| 451 | + break; | ||
| 452 | + case ThirdLoginTypeCheckIsRegister: | ||
| 453 | + { | ||
| 454 | + [CNLiveUserSystemCenter thirdPartyCheckLoginWithThirdPartyPlatType:@"1" thirdPartyId:[dic objectForKey:@"id"] frmId:@"" success:^(id result) { | ||
| 455 | + NSLog(@"验证三方微博登录------%@",result); | ||
| 456 | + [Tools setUserLogin:YES]; | ||
| 457 | + [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | ||
| 458 | + [UserInfoSava saveUserinfoDic:result[@"data"]]; | ||
| 459 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | ||
| 460 | + | ||
| 461 | + } failure:^(NSDictionary *errorDic) { | ||
| 462 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | ||
| 463 | + }]; | ||
| 464 | + } | ||
| 465 | + break; | ||
| 466 | + case ThirdLoginTypeBindMobile: | ||
| 467 | + { | ||
| 468 | + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeShortcutLogin mobile:self.bindMobile success:^(id result) { | ||
| 469 | + NSLog(@"ver %@",result); | ||
| 470 | + if ([result[@"errorCode"] isEqualToString:@"0"]) { | ||
| 471 | + | ||
| 472 | + NSString *location = [dic objectForKey:@"location"]; | ||
| 473 | + NSString *partyId = [dic objectForKey:@"id"]; | ||
| 474 | + NSString *faceUrl = [dic objectForKey:@"avatar_hd"]; | ||
| 475 | + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:partyId,@"partyId",gender,@"gender",location,@"location",faceUrl,@"faceUrl",@"1",@"platType",self.bindMobile,@"mobile", nil]; | ||
| 476 | + [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:dic]; | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + } failure:^(NSDictionary *errorDic) { | ||
| 480 | + NSLog(@"%@",errorDic); | ||
| 481 | + }]; | ||
| 482 | + } | ||
| 483 | + break; | ||
| 484 | + default: | ||
| 485 | + break; | ||
| 486 | + } | ||
| 368 | } | 487 | } |
| 369 | } | 488 | } |
| 370 | } | 489 | } |
CNLiveUserSystemSDK.xcodeproj/xcuserdata/cnlive.xcuserdatad/xcschemes/CNLiveUserSystemSDK.xcscheme
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<Scheme | ||
| 3 | + LastUpgradeVersion = "0830" | ||
| 4 | + version = "1.3"> | ||
| 5 | + <BuildAction | ||
| 6 | + parallelizeBuildables = "YES" | ||
| 7 | + buildImplicitDependencies = "YES"> | ||
| 8 | + <BuildActionEntries> | ||
| 9 | + <BuildActionEntry | ||
| 10 | + buildForTesting = "YES" | ||
| 11 | + buildForRunning = "YES" | ||
| 12 | + buildForProfiling = "YES" | ||
| 13 | + buildForArchiving = "YES" | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 15 | + <BuildableReference | ||
| 16 | + BuildableIdentifier = "primary" | ||
| 17 | + BlueprintIdentifier = "818734E01DA8F5B900046D84" | ||
| 18 | + BuildableName = "CNLiveUserSystemSDK.framework" | ||
| 19 | + BlueprintName = "CNLiveUserSystemSDK" | ||
| 20 | + ReferencedContainer = "container:CNLiveUserSystemSDK.xcodeproj"> | ||
| 21 | + </BuildableReference> | ||
| 22 | + </BuildActionEntry> | ||
| 23 | + </BuildActionEntries> | ||
| 24 | + </BuildAction> | ||
| 25 | + <TestAction | ||
| 26 | + buildConfiguration = "Debug" | ||
| 27 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 28 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 29 | + shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| 30 | + <Testables> | ||
| 31 | + </Testables> | ||
| 32 | + <AdditionalOptions> | ||
| 33 | + </AdditionalOptions> | ||
| 34 | + </TestAction> | ||
| 35 | + <LaunchAction | ||
| 36 | + buildConfiguration = "Debug" | ||
| 37 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 38 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 39 | + launchStyle = "0" | ||
| 40 | + useCustomWorkingDirectory = "NO" | ||
| 41 | + ignoresPersistentStateOnLaunch = "NO" | ||
| 42 | + debugDocumentVersioning = "YES" | ||
| 43 | + debugServiceExtension = "internal" | ||
| 44 | + allowLocationSimulation = "YES"> | ||
| 45 | + <MacroExpansion> | ||
| 46 | + <BuildableReference | ||
| 47 | + BuildableIdentifier = "primary" | ||
| 48 | + BlueprintIdentifier = "818734E01DA8F5B900046D84" | ||
| 49 | + BuildableName = "CNLiveUserSystemSDK.framework" | ||
| 50 | + BlueprintName = "CNLiveUserSystemSDK" | ||
| 51 | + ReferencedContainer = "container:CNLiveUserSystemSDK.xcodeproj"> | ||
| 52 | + </BuildableReference> | ||
| 53 | + </MacroExpansion> | ||
| 54 | + <AdditionalOptions> | ||
| 55 | + </AdditionalOptions> | ||
| 56 | + </LaunchAction> | ||
| 57 | + <ProfileAction | ||
| 58 | + buildConfiguration = "Release" | ||
| 59 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
| 60 | + savedToolIdentifier = "" | ||
| 61 | + useCustomWorkingDirectory = "NO" | ||
| 62 | + debugDocumentVersioning = "YES"> | ||
| 63 | + <MacroExpansion> | ||
| 64 | + <BuildableReference | ||
| 65 | + BuildableIdentifier = "primary" | ||
| 66 | + BlueprintIdentifier = "818734E01DA8F5B900046D84" | ||
| 67 | + BuildableName = "CNLiveUserSystemSDK.framework" | ||
| 68 | + BlueprintName = "CNLiveUserSystemSDK" | ||
| 69 | + ReferencedContainer = "container:CNLiveUserSystemSDK.xcodeproj"> | ||
| 70 | + </BuildableReference> | ||
| 71 | + </MacroExpansion> | ||
| 72 | + </ProfileAction> | ||
| 73 | + <AnalyzeAction | ||
| 74 | + buildConfiguration = "Debug"> | ||
| 75 | + </AnalyzeAction> | ||
| 76 | + <ArchiveAction | ||
| 77 | + buildConfiguration = "Release" | ||
| 78 | + revealArchiveInOrganizer = "YES"> | ||
| 79 | + </ArchiveAction> | ||
| 80 | +</Scheme> |
Products/CNLiveUserSystemSDK.framework/CNLiveUserSystemSDK
No preview for this file type
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemCenter.h
| @@ -178,8 +178,86 @@ | @@ -178,8 +178,86 @@ | ||
| 178 | 178 | ||
| 179 | 179 | ||
| 180 | /** | 180 | /** |
| 181 | + 通过邮箱修改密码 | ||
| 182 | + | ||
| 183 | + @param email 邮箱 | ||
| 184 | + @param newPwd 新密码 | ||
| 185 | + @param success 成功回调 | ||
| 186 | + @param failure 失败回调 | ||
| 187 | + */ | ||
| 188 | ++ (void)modifyPwdWithEmail:(NSString *)email newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 189 | + | ||
| 190 | + | ||
| 191 | +/** | ||
| 192 | + 通过原密码修改密码 | ||
| 193 | + | ||
| 194 | + @param uid 用户ID | ||
| 195 | + @param pwd 原密码 | ||
| 196 | + @param newPwd 新密码 | ||
| 197 | + @param success 成功回调 | ||
| 198 | + @param failure 失败回调 | ||
| 199 | + */ | ||
| 200 | ++ (void)oldPwdChangePasswordWithUid:(NSString *)uid pwd:(NSString *)pwd newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 201 | + | ||
| 202 | + | ||
| 203 | +/** | ||
| 204 | + 注册前校验手机验证码 | ||
| 205 | + | ||
| 206 | + @param mobile 手机号 | ||
| 207 | + @param verificationCode 验证码 | ||
| 208 | + @param success 成功回调 | ||
| 209 | + @param getVersion 失败回调 | ||
| 210 | + */ | ||
| 211 | ++ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 212 | + | ||
| 213 | + | ||
| 214 | +/** | ||
| 215 | + 快捷登录前校验手机验证码 | ||
| 216 | + | ||
| 217 | + @param mobile 手机号 | ||
| 218 | + @param verificationCode 验证码 | ||
| 219 | + @param success 成功回调 | ||
| 220 | + @param failure 失败回调 | ||
| 221 | + */ | ||
| 222 | ++ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 223 | + | ||
| 224 | + | ||
| 225 | +/** | ||
| 226 | + 验证第三方账号是否注册,若注册则直接登录返回用户信息,若未注册返回errorCode | ||
| 227 | + | ||
| 228 | + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | ||
| 229 | + @param thirdPartyId 第三方用户ID | ||
| 230 | + @param frmId 渠道ID(非必填) | ||
| 231 | + @param success 成功回调 | ||
| 232 | + @param failure 失败回调 | ||
| 233 | + */ | ||
| 234 | ++ (void)thirdPartyCheckLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | ||
| 235 | + | ||
| 236 | + | ||
| 237 | +/** | ||
| 238 | + 第三方注册强制绑定手机号登录: 手机号+密码+验证码+三方账号 | ||
| 239 | + | ||
| 240 | + @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | ||
| 241 | + @param thirdPartyId 第三方用户ID | ||
| 242 | + @param nickName 用户昵称 | ||
| 243 | + @param gender 性别,m:男、f:女、n:未知(非必填) | ||
| 244 | + @param location 用户所在地(非必填) | ||
| 245 | + @param faceUrl 头像,约100*100(非必填) | ||
| 246 | + @param mobile 手机号 | ||
| 247 | + @param verificationCode 验证码 (验证码类型为快捷登录VerificationCodeTypeShortcutLogin) | ||
| 248 | + @param pawd 注册密码 | ||
| 249 | + @param frmId 渠道ID(非必填) | ||
| 250 | + @param success 成功回调 | ||
| 251 | + @param failure 失败回调 | ||
| 252 | + */ | ||
| 253 | ++ (void)thirdPartyBindMobileLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode pawd:(NSString *)pawd frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | ||
| 254 | + | ||
| 255 | + | ||
| 256 | +/** | ||
| 181 | * 获取SDK版本号 | 257 | * 获取SDK版本号 |
| 182 | */ | 258 | */ |
| 183 | + (NSString *)getVersion; | 259 | + (NSString *)getVersion; |
| 184 | 260 | ||
| 261 | + | ||
| 262 | + | ||
| 185 | @end | 263 | @end |
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemTypeDef.h
| @@ -24,4 +24,10 @@ typedef NS_ENUM(NSUInteger, UserInfoType) { | @@ -24,4 +24,10 @@ typedef NS_ENUM(NSUInteger, UserInfoType) { | ||
| 24 | UserInfoTypeLocation, //联系方式(地址) | 24 | UserInfoTypeLocation, //联系方式(地址) |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | +//校验验证码 | ||
| 28 | +typedef NS_ENUM(NSInteger, CheckVerificationCodeType) { | ||
| 29 | + CheckVerificationCodeTypeRegister = 0,//注册前校验验证码 | ||
| 30 | + CheckVerificationCodeTypeShortcutLogin //快捷登录前校验验证码 | ||
| 31 | +}; | ||
| 32 | + | ||
| 27 | #endif /* CNLiveUserSystemTypeDef_h */ | 33 | #endif /* CNLiveUserSystemTypeDef_h */ |
Products/CNLiveUserSystemSDK.framework/Info.plist
No preview for this file type