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);
}
});
init() {
this._super(...arguments);
// Indicate that the message is now being displayed
if (this.message.visible === undefined) {
// Should really be in didInsertElement but Glimmer doesn't allow this
this.set('message.visible', true);
}
this.run = Runner.create({ disabled: !Notify.testing });
},
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.');
}
}
}
import Notify from 'ember-notify';
var App;
// avoid slowing down the tests
Notify.View.reopen({
closeAfter: 0,
removeAfter: 0
});
module('ember-notify', {
setup: function() {
Ember.run(function() {
App = Ember.Application.create({
rootElement: '#ember-testing'
});
App.setupForTesting();
App.injectTestHelpers();
});
},
teardown: function() {
App.reset();
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);
};