public function reset($link, $newPassword)
    {
        // Visit link to get current reset token, username and token expiration
        $this->get($link);
        $this->request->dropCookies();

        $urlData = $this->parseCurrentUrl();

        $isValidUrlData = isset($urlData['query'], $urlData['path']);
        if (!$isValidUrlData) {
            return false;
        }

        $username = trim(str_replace('/pw/', '', $urlData['path']), '/');

        $query = [];

        parse_str($urlData['query'], $query);

        $isValidQuery = isset($query['e'], $query['t']);
        if (!$isValidQuery) {
            return false;
        }

        $request = [
            'username'             => $username,
            'new_password'         => $newPassword,
            'new_password_confirm' => $newPassword,
            'token'                => $query['t'],
            'expiration'           => $query['e'],
        ];

        return $this->post(UrlBuilder::RESOURCE_RESET_PASSWORD_UPDATE, $request);
    }
public function reset($link, $newPassword)
    {
        // Visit link to get current reset token, username and token expiration
        $this->get($link);
        $this->request->dropCookies();

        $urlData = $this->parseCurrentUrl();

        $isValidUrlData = isset($urlData['query'], $urlData['path']);
        if (!$isValidUrlData) {
            return false;
        }

        $username = trim(str_replace('/pw/', '', $urlData['path']), '/');

        $query = [];

        parse_str($urlData['query'], $query);

        $isValidQuery = isset($query['e'], $query['t']);
        if (!$isValidQuery) {
            return false;
        }

        $request = [
            'username'             => $username,
            'new_password'         => $newPassword,
            'new_password_confirm' => $newPassword,
            'token'                => $query['t'],
            'expiration'           => $query['e'],
        ];

        return $this->post(UrlBuilder::RESOURCE_RESET_PASSWORD_UPDATE, $request);
    }
public function reset ( $ link , $ newPassword ) { // Visit link to get current reset token, username and token expiration $ this -> get ( $ link ) ; $ this -> request -> dropCookies ( ) ; $ urlData = $ this -> parseCurrentUrl ( ) ; $ isValidUrlData = isset ( $ urlData [ 'query' ] , $ urlData [ 'path' ] ) ; if ( ! $ isValidUrlData ) { return false ; } $ username = trim ( str_replace ( '/pw/' , '' , $ urlData [ 'path' ] ) , '/' ) ; $ query = [ ] ; parse_str ( $ urlData [ 'query' ] , $ query ) ; $ isValidQuery = isset ( $ query [ 'e' ] , $ query [ 't' ] ) ; if ( ! $ isValidQuery ) { return false ; } $ request = [ 'username' => $ username , 'new_password' => $ newPassword , 'new_password_confirm' => $ newPassword , 'token' => $ query [ 't' ] , 'expiration' => $ query [ 'e' ] , ] ; return $ this -> post ( UrlBuilder :: RESOURCE_RESET_PASSWORD_UPDATE , $ request ) ; }
Set a new password by link from reset password email

@param string $link
@param string $newPassword
@return bool
Set a new password by link from reset password email