Beispiel #1
0
 public function testPassword()
 {
     if (!$this->doTest(__FUNCTION__)) {
         return;
     }
     //perform assertion
     $this->assertEquals(GoCoin::getApiMode(), 'test');
     $this->assertNotEmpty(TOKEN);
     //an array to update the password
     $pw_array = array("current_password" => "passw0rd", "password" => "newpassw0rd", "password_confirmation" => "newpassw0rd");
     //update the password
     $pw_update = GoCoin::updatePassword(TOKEN, USER_ID, $pw_array);
     $this->assertEquals($pw_update->code, '204');
     //put the password back
     $pw_array = array("current_password" => "newpassw0rd", "password" => "passw0rd", "password_confirmation" => "passw0rd");
     //update the password back
     $pw_update = GoCoin::updatePassword(TOKEN, USER_ID, $pw_array);
     $this->assertEquals($pw_update->code, '204');
     echo '[DEBUG]: SUCCESS' . "\n";
 }
Beispiel #2
0
if ($PASSWORD) {
    echo '<h3 style="color:blue">Password Update Test</h3>';
    //an array to update the password
    $pw_array = array("current_password" => "passw0rd", "password" => "newpassw0rd", "password_confirmation" => "newpassw0rd");
    //update the password
    $pw_update = GoCoin::updatePassword($token, USER_ID, $pw_array);
    if ($pw_update->code == '204') {
        echo '<div>Password successfully updated!</div>';
    } else {
        echo '<div>Password update failure:</div>';
        var_dump($pw_update);
    }
    //put the password back
    $pw_array = array("current_password" => "newpassw0rd", "password" => "passw0rd", "password_confirmation" => "passw0rd");
    //update the password back
    $pw_update = GoCoin::updatePassword($token, USER_ID, $pw_array);
    if ($pw_update->code == '204') {
        echo '<div>Password successfully put back!</div>';
    } else {
        echo '<div>Password update failure:</div>';
        var_dump($pw_update);
    }
}
//reset password tests
$RESET = FALSE;
if ($RESET) {
    echo '<h3 style="color:blue">Password Reset Test</h3>';
    if (empty(PW_RESET_TOKEN)) {
        //request a password reset
        $reset_pw_req = GoCoin::resetPassword($token, USER_EMAIL);
        if ($reset_pw_req->code == '204') {