Add email and password if non-token login

This commit is contained in:
Brandon Russell
2016-03-19 23:14:28 -05:00
parent 4386daf7a0
commit 72340845e5
2 changed files with 20 additions and 22 deletions

View File

@@ -1219,19 +1219,18 @@ var InternalClient = (function () {
//def updateDetails
InternalClient.prototype.updateDetails = function updateDetails(data) {
if (!this.email && !data.email) {
return this.apiRequest("patch", _Constants.Endpoints.ME, true, {
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
username: data.username || this.user.username
});
}
return this.apiRequest("patch", _Constants.Endpoints.ME, true, {
var options = {
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
email: data.email || this.email,
new_password: data.newPassword || null,
password: data.password || this.password,
username: data.username || this.user.username
});
};
if (this.email || data.email) {
options.email = data.email || this.email;
options.new_password = data.newPassword || null;
options.password = data.password || this.password;
}
return this.apiRequest("patch", _Constants.Endpoints.ME, true, options);
};
//def setAvatar

View File

@@ -1005,19 +1005,18 @@ export default class InternalClient {
//def updateDetails
updateDetails(data) {
if (!this.email && !data.email) {
return this.apiRequest("patch", Endpoints.ME, true, {
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
username: data.username || this.user.username
});
}
return this.apiRequest("patch", Endpoints.ME, true, {
var options = {
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
email: data.email || this.email,
new_password: data.newPassword || null,
password: data.password || this.password,
username: data.username || this.user.username
});
}
if (this.email || data.email) {
options.email = data.email || this.email;
options.new_password = data.newPassword || null;
options.password = data.password || this.password;
}
return this.apiRequest("patch", Endpoints.ME, true, options);
}
//def setAvatar