From 2ca232e7cc3e2303b63eb99bc065d93b27c87ca3 Mon Sep 17 00:00:00 2001 From: pzheng Date: Mon, 4 Mar 2024 11:48:21 +0800 Subject: [PATCH 1/3] chore: add phoneNumber when verify sms --- AVOS/LeanCloudObjcTests/LCUserTestCase.swift | 14 ++++++++++++++ AVOS/Sources/Foundation/User/LCUser.h | 8 +++++--- AVOS/Sources/Foundation/User/LCUser.m | 13 +++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/AVOS/LeanCloudObjcTests/LCUserTestCase.swift b/AVOS/LeanCloudObjcTests/LCUserTestCase.swift index 1131298e..ba94cb6e 100644 --- a/AVOS/LeanCloudObjcTests/LCUserTestCase.swift +++ b/AVOS/LeanCloudObjcTests/LCUserTestCase.swift @@ -15,6 +15,20 @@ class LCUserTestCase: BaseTestCase { static let testablePhoneNumber = "+8618622223333" static let testableSMSCode = "170402" + func testResetPasswordWithSmsCode() { + expecting() { exp in + LCUser.resetPassword( + withSmsCode: LCUserTestCase.testableSMSCode, + newPassword: "22223333", + phoneNumber: LCUserTestCase.testablePhoneNumber) + { succeeded, error in + XCTAssertTrue(succeeded) + XCTAssertNil(error) + exp.fulfill() + } + } + } + func testSignUpAndLoginAndOther() { let username = uuid diff --git a/AVOS/Sources/Foundation/User/LCUser.h b/AVOS/Sources/Foundation/User/LCUser.h index e0ce5e0a..11804201 100644 --- a/AVOS/Sources/Foundation/User/LCUser.h +++ b/AVOS/Sources/Foundation/User/LCUser.h @@ -380,11 +380,13 @@ FOUNDATION_EXPORT LeanCloudSocialPlatform const LeanCloudSocialPlatformWeiXin; * 使用验证码重置密码 * @param code 6位验证码 * @param password 新密码 + * @param phoneNumber 手机号码 * @param block 回调结果 */ -+(void)resetPasswordWithSmsCode:(NSString *)code - newPassword:(NSString *)password - block:(LCBooleanResultBlock)block; ++ (void)resetPasswordWithSmsCode:(NSString *)code + newPassword:(NSString *)password + phoneNumber:(NSString *)phoneNumber + block:(LCBooleanResultBlock)block; /*! * 用 sessionToken 来登录用户 diff --git a/AVOS/Sources/Foundation/User/LCUser.m b/AVOS/Sources/Foundation/User/LCUser.m index f3fc3d51..246ca4ef 100644 --- a/AVOS/Sources/Foundation/User/LCUser.m +++ b/AVOS/Sources/Foundation/User/LCUser.m @@ -726,13 +726,18 @@ + (void)requestPasswordResetCodeForPhoneNumber:(NSString *)phoneNumber }]; } -+(void)resetPasswordWithSmsCode:(NSString *)code - newPassword:(NSString *)password - block:(LCBooleanResultBlock)block { ++ (void)resetPasswordWithSmsCode:(NSString *)code + newPassword:(NSString *)password + phoneNumber:(NSString *)phoneNumber + block:(LCBooleanResultBlock)block { NSParameterAssert(code); NSString *path=[NSString stringWithFormat:@"resetPasswordBySmsCode/%@",code]; - [[LCPaasClient sharedInstance] putObject:path withParameters:@{ @"password" : password } sessionToken:nil block:^(id object, NSError *error) { + [[LCPaasClient sharedInstance] putObject:path + withParameters:@{ @"password" : password, + @"mobilePhoneNumber" : phoneNumber } + sessionToken:nil + block:^(id object, NSError *error) { [LCUtils callBooleanResultBlock:block error:error]; }]; } From c1ae7eb17052927a5600dadb189509ef7200158a Mon Sep 17 00:00:00 2001 From: pzheng Date: Mon, 4 Mar 2024 15:09:25 +0800 Subject: [PATCH 2/3] release: 14.0.0 --- AVOS/Sources/Foundation/User/LCUser.m | 2 +- AVOS/Sources/Foundation/UserAgent.h | 2 +- LeanCloudObjc.podspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AVOS/Sources/Foundation/User/LCUser.m b/AVOS/Sources/Foundation/User/LCUser.m index 246ca4ef..b63dcc97 100644 --- a/AVOS/Sources/Foundation/User/LCUser.m +++ b/AVOS/Sources/Foundation/User/LCUser.m @@ -740,7 +740,7 @@ + (void)resetPasswordWithSmsCode:(NSString *)code block:^(id object, NSError *error) { [LCUtils callBooleanResultBlock:block error:error]; }]; -} +}1 // MARK: - query diff --git a/AVOS/Sources/Foundation/UserAgent.h b/AVOS/Sources/Foundation/UserAgent.h index e7e3a351..11181b33 100644 --- a/AVOS/Sources/Foundation/UserAgent.h +++ b/AVOS/Sources/Foundation/UserAgent.h @@ -1 +1 @@ -#define SDK_VERSION @"13.9.3" +#define SDK_VERSION @"14.0.0" diff --git a/LeanCloudObjc.podspec b/LeanCloudObjc.podspec index 92177858..fe1050cb 100644 --- a/LeanCloudObjc.podspec +++ b/LeanCloudObjc.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'LeanCloudObjc' - s.version = '13.9.3' + s.version = '14.0.0' s.homepage = 'https://leancloud.cn/' s.summary = 'LeanCloud Objective-C SDK' s.authors = 'LeanCloud' From b134a05940c3c47682417671f581e7d0f3768fe5 Mon Sep 17 00:00:00 2001 From: pzheng Date: Mon, 4 Mar 2024 15:10:46 +0800 Subject: [PATCH 3/3] chore: typo --- AVOS/Sources/Foundation/User/LCUser.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AVOS/Sources/Foundation/User/LCUser.m b/AVOS/Sources/Foundation/User/LCUser.m index b63dcc97..246ca4ef 100644 --- a/AVOS/Sources/Foundation/User/LCUser.m +++ b/AVOS/Sources/Foundation/User/LCUser.m @@ -740,7 +740,7 @@ + (void)resetPasswordWithSmsCode:(NSString *)code block:^(id object, NSError *error) { [LCUtils callBooleanResultBlock:block error:error]; }]; -}1 +} // MARK: - query