Method: AuthingRuby::AuthenticationClient#resetPasswordByPhoneCode

Defined in:
lib/authing_ruby/authentication/AuthenticationClient.rb

#resetPasswordByPhoneCode(phone, code, newPassword) ⇒ Object

通过短信验证码重置密码



708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/authing_ruby/authentication/AuthenticationClient.rb', line 708

def resetPasswordByPhoneCode(phone, code, newPassword)
  publicKey = @publicKeyManager.getPublicKey()
  newPasswordEncrypted = AuthingRuby::Utils.encrypt(newPassword, publicKey)

  variables = {
    "phone": phone,
    "code": code,
    "newPassword": newPasswordEncrypted,
  }
  graphqlAPI = AuthingRuby::GraphQLAPI.new
  resp = graphqlAPI.resetPassword(@graphqlClient, @tokenProvider, variables)
  json = JSON.parse(resp)
  result = json.dig("data", "resetPassword") # {"message":"重置密码成功!","code":200}
  return result if result
  return json
end