Commit 9636e874 authored by Laurent's avatar Laurent

clean OrpheeMedia adapter

parent e33b68df
......@@ -143,32 +143,6 @@ export class OrpheeMedia extends PortalAdapter {
}
protected _requestWorkaroundCookies(account: Account, options: any): Promise<http.HttpResponse> {
options.dontFollowRedirects = true;
let cookies = account.getCookies();
if (cookies.length > 0) {
options.headers['Cookie'] = cookies.map( (cookie) => {
return cookie.toString();
});
account.setCookies([]);
}
return this
.request(account, options)
.then( (response) => {
if (account.getCookies().length == 0)
account.setCookies(cookies);
if (response.statusCode == 301 || response.statusCode == 302 || response.statusCode == 303)
return this.request( account,
{ url: account.getUrl() });
return response;
});
}
protected _signIn(account): Promise<any> {
if (!(account.credentials['login'] && account.credentials['password']))
return Promise.reject(new WrongLoginPassword());
......@@ -217,11 +191,11 @@ export class OrpheeMedia extends PortalAdapter {
return this
._requestWorkaroundCookies(account,
{ url: account.getUrl(),
method: "POST",
content: this._encodeForm(login_data),
headers: {"Content-Type": "application/x-www-form-urlencoded" } })
.request(account,
{ url: account.getUrl(),
method: "POST",
content: this._encodeForm(login_data),
headers: {"Content-Type": "application/x-www-form-urlencoded" } })
.then( (response) => {
return this._handleLoginResponse(account, response, account.getUrl())
} );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment