Skip to content

Commit d122e44

Browse files
authored
Merge pull request #701 from leancloud/chore/add-phoneNumber-when-verify-sms
chore: add phoneNumber when verify sms
2 parents 828992d + b134a05 commit d122e44

File tree

5 files changed

+30
-9
lines changed

5 files changed

+30
-9
lines changed

AVOS/LeanCloudObjcTests/LCUserTestCase.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ class LCUserTestCase: BaseTestCase {
1515
static let testablePhoneNumber = "+8618622223333"
1616
static let testableSMSCode = "170402"
1717

18+
func testResetPasswordWithSmsCode() {
19+
expecting() { exp in
20+
LCUser.resetPassword(
21+
withSmsCode: LCUserTestCase.testableSMSCode,
22+
newPassword: "22223333",
23+
phoneNumber: LCUserTestCase.testablePhoneNumber)
24+
{ succeeded, error in
25+
XCTAssertTrue(succeeded)
26+
XCTAssertNil(error)
27+
exp.fulfill()
28+
}
29+
}
30+
}
31+
1832
func testSignUpAndLoginAndOther() {
1933

2034
let username = uuid

AVOS/Sources/Foundation/User/LCUser.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,13 @@ FOUNDATION_EXPORT LeanCloudSocialPlatform const LeanCloudSocialPlatformWeiXin;
380380
* 使用验证码重置密码
381381
* @param code 6位验证码
382382
* @param password 新密码
383+
* @param phoneNumber 手机号码
383384
* @param block 回调结果
384385
*/
385-
+(void)resetPasswordWithSmsCode:(NSString *)code
386-
newPassword:(NSString *)password
387-
block:(LCBooleanResultBlock)block;
386+
+ (void)resetPasswordWithSmsCode:(NSString *)code
387+
newPassword:(NSString *)password
388+
phoneNumber:(NSString *)phoneNumber
389+
block:(LCBooleanResultBlock)block;
388390

389391
/*!
390392
* 用 sessionToken 来登录用户

AVOS/Sources/Foundation/User/LCUser.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,13 +726,18 @@ + (void)requestPasswordResetCodeForPhoneNumber:(NSString *)phoneNumber
726726
}];
727727
}
728728

729-
+(void)resetPasswordWithSmsCode:(NSString *)code
730-
newPassword:(NSString *)password
731-
block:(LCBooleanResultBlock)block {
729+
+ (void)resetPasswordWithSmsCode:(NSString *)code
730+
newPassword:(NSString *)password
731+
phoneNumber:(NSString *)phoneNumber
732+
block:(LCBooleanResultBlock)block {
732733
NSParameterAssert(code);
733734

734735
NSString *path=[NSString stringWithFormat:@"resetPasswordBySmsCode/%@",code];
735-
[[LCPaasClient sharedInstance] putObject:path withParameters:@{ @"password" : password } sessionToken:nil block:^(id object, NSError *error) {
736+
[[LCPaasClient sharedInstance] putObject:path
737+
withParameters:@{ @"password" : password,
738+
@"mobilePhoneNumber" : phoneNumber }
739+
sessionToken:nil
740+
block:^(id object, NSError *error) {
736741
[LCUtils callBooleanResultBlock:block error:error];
737742
}];
738743
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define SDK_VERSION @"13.9.3"
1+
#define SDK_VERSION @"14.0.0"

LeanCloudObjc.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'LeanCloudObjc'
3-
s.version = '13.9.3'
3+
s.version = '14.0.0'
44
s.homepage = 'https://leancloud.cn/'
55
s.summary = 'LeanCloud Objective-C SDK'
66
s.authors = 'LeanCloud'

0 commit comments

Comments
 (0)