Allow tokens to be used for login, fixes #159

This commit is contained in:
meew0
2016-01-24 14:33:39 +01:00
parent 76ab439033
commit 3caf1f74cc
2 changed files with 40 additions and 23 deletions

View File

@@ -79,6 +79,19 @@ export default class Client extends EventEmitter {
this.internal.userAgent = userAgent;
}
// def loginWithToken
loginWithToken(token, email = null, password = null, callback = (/*err, token*/) => {}) {
if (typeof email === "function") {
// email is the callback
callback = email;
email = null;
password = null;
}
return this.internal.loginWithToken(token, email, password)
.then(dataCallback(callback), errorCallback(callback));
}
// def login
login(email, password, callback = (/*err, token*/) => { }) {
return this.internal.login(email, password)