Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$.post('/api/v1/changePassword/' + this.get('session.currentUser.id'), {existingPassword: this.get('existingPassword'), newPassword: this.get('newPassword')}, function(data) {
console.log(data);
if (data.existingPassword) {
Notify.warning(data.existingPassword);
} else if (data.user) {
Notify.success('The password was successfully changed.');
// Reset the fields to null/blank
self.set('existingPassword', null);
self.set('newPassword', null);
self.set('confirmPassword', null);
}
});
add_producer: function() {
var store = this.store;
var self = this;
// Some shitty validation, real validation on the server
if (!this.get('name')) {
Notify.warning('Please ensure the name of the producer is filled out.');
return;
}
// Temporary way to convert empty string into null
if (!this.get('description')) {
this.set('description', null);
}
var producer = store.createRecord('producer', {
producer_logo: this.get('producer_logo'),
name: this.get('name').trim(),
slug: this.get('slug'),
description: this.get('description'),
});
if (data.existingPassword) {
Notify.warning(data.existingPassword);
} else if (data.user) {
Notify.success('The password was successfully changed.');
// Reset the fields to null/blank
self.set('existingPassword', null);
self.set('newPassword', null);
self.set('confirmPassword', null);
}
});
} else {
Notify.warning('New Password confirmation failed.');
}
}
}
var onFailure = function() {
var msg = "Something went wrong, avatar was not updated";
console.log(msg);
Notify.warning(msg);
};
var onFailure = function() {
var msg = "Something went wrong, character was not updated.";
console.log(msg);
Notify.warning(msg);
};
var onFailure = function() {
var msg = "Something went wrong, person was not updated.";
console.log(msg);
Notify.warning(msg);
};
var onFailure = function(producer) {
console.log('Failed');
var msg = "Something went wrong, " + producer.get('name') + " was not added.";
console.log(msg);
Notify.warning(msg);
};
var onFailure = function() {
var msg = "Something went wrong, profile banner was not updated";
console.log(msg);
Notify.warning(msg);
};
var onFailure = function(response) {
var msg;
if (response.message) {
msg = response.message;
} else {
msg = "Something went wrong, producer was not added.";
}
console.log(msg);
Notify.warning(msg);
};
$.post('/api/v1/requestInvite', {email: email, username: username}, function(data) {
if (data.username) {
console.log(data.username[0]);
Notify.warning(data.username[0]);
}
if (data.email) {
Notify.warning(data.email[0]);
}
if ( data === undefined || data === '' ) {
Notify.success('Invite request received.');
}
}).fail(function() {
Notify.warning('Something went wrong, invite request was not received.');