Skip to content

Commit

Permalink
Merge pull request #701 from leancloud/chore/add-phoneNumber-when-ver…
Browse files Browse the repository at this point in the history
…ify-sms

chore: add phoneNumber when verify sms
  • Loading branch information
zapcannon87 authored Mar 4, 2024
2 parents 828992d + b134a05 commit d122e44
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
14 changes: 14 additions & 0 deletions AVOS/LeanCloudObjcTests/LCUserTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions AVOS/Sources/Foundation/User/LCUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 来登录用户
Expand Down
13 changes: 9 additions & 4 deletions AVOS/Sources/Foundation/User/LCUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}];
}
Expand Down
2 changes: 1 addition & 1 deletion AVOS/Sources/Foundation/UserAgent.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define SDK_VERSION @"13.9.3"
#define SDK_VERSION @"14.0.0"
2 changes: 1 addition & 1 deletion LeanCloudObjc.podspec
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit d122e44

Please sign in to comment.