Skip to content

Commit

Permalink
Merge pull request microsoft#10 from Microsoft/remove-local-auth
Browse files Browse the repository at this point in the history
Remove local auth from sdk
  • Loading branch information
shishirx34 committed Oct 13, 2015
2 parents cd79990 + c50ecd9 commit e7c5d5b
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions sdk/script/management/account-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,73 +56,6 @@ export class AccountManager {
this.serverUrl = serverUrl;
}

public registerLocal(name: string, email: string, password: string): Promise<void> {
return Promise<void>((resolve, reject, notify) => {
var req = request.post(this.serverUrl + "/auth/register/local");
this.attachCredentials(req, request);

req.type("form")
.send({ name: name })
.send({ email: email })
.send({ password: password })
.end((err: any, res: request.Response) => {
if (err) {
reject(<CodePushError>{ message: err.message });
return;
}

if (this._saveAuthedAgent) {
this._authedAgent = request.agent();
this._authedAgent.saveCookies(res);
}

if (res.ok) {
resolve(null);
} else {
var body = tryJSON(res.text);
if (body) {
reject(<CodePushError>body);
} else {
reject(<CodePushError>{ message: res.text, statusCode: res.status });
}
}
});
});
}

public loginLocal(email: string, password: string): Promise<void> {
return Promise<void>((resolve, reject, notify) => {
var req = request.post(this.serverUrl + "/auth/login/local");
this.attachCredentials(req, request);

req.type("form")
.send({ email: email })
.send({ password: password })
.end((err: any, res: request.Response) => {
if (err) {
reject(<CodePushError>{ message: err.message });
return;
}

if (this._saveAuthedAgent) {
this._authedAgent = request.agent();
this._authedAgent.saveCookies(res);
}

if (res.ok) {
resolve(null);
} else {
var body = tryJSON(res.text);
if (body) {
reject(<CodePushError>body);
} else {
reject(<CodePushError>{ message: res.text, statusCode: res.status });
}
}
});
});
}

public loginWithAccessToken(accessToken: string): Promise<void> {
return Promise<void>((resolve, reject, notify) => {
var loginInfo: ILoginInfo = AccountManager.getLoginInfo(accessToken);
Expand Down

0 comments on commit e7c5d5b

Please sign in to comment.