Skip to content

Commit 2ca232e

Browse files
committed
chore: add phoneNumber when verify sms
1 parent 828992d commit 2ca232e

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
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
}

0 commit comments

Comments
 (0)