Skip to content

Commit

Permalink
fix: require phone number when verify sms code
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu Yun committed May 10, 2024
1 parent 7143b44 commit 6342c29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/LeanCloud/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,11 @@ public static function requestPasswordResetBySmsCode($phoneNumber) {
* @param string $smsCode
* @param string $newPassword
*/
public static function resetPasswordBySmsCode($smsCode, $newPassword) {
Client::put("/resetPasswordBySmsCode/{$smsCode}",
array("password" => $newPassword));
public static function resetPasswordBySmsCode($smsCode, $newPassword, $mobilePhoneNumber) {
Client::put("/resetPasswordBySmsCode/{$smsCode}", array(
"password" => $newPassword,
"mobilePhoneNumber" => $mobilePhoneNumber
));
}

/**
Expand All @@ -463,8 +465,10 @@ public static function requestMobilePhoneVerify($phoneNumber) {
*
* @param string $smsCode
*/
public static function verifyMobilePhone($smsCode) {
Client::post("/verifyMobilePhone/{$smsCode}", null);
public static function verifyMobilePhone($smsCode, $mobilePhoneNumber) {
Client::post("/verifyMobilePhone/{$smsCode}", array(
"mobilePhoneNumber" => $mobilePhoneNumber
));
}

/**
Expand Down Expand Up @@ -591,4 +595,3 @@ public function unlinkWith($provider) {
}

}

3 changes: 1 addition & 2 deletions test/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function testUpdatePassword() {
public function testVerifyMobilePhone() {
// Ensure the post format is correct
$this->setExpectedException("LeanCloud\CloudException", null, 603);
User::verifyMobilePhone("000000");
User::verifyMobilePhone("000000", "18612340000");
}

public function testSignUpOrLoginByMobilePhone() {
Expand Down Expand Up @@ -308,4 +308,3 @@ public function testFindUserWithSession() {
}

}

0 comments on commit 6342c29

Please sign in to comment.