Merge pull request #702 from simonbengtsson/before-save-login

Don't trigger beforeSave when logging in with a provider
This commit is contained in:
Fosco Marotto
2016-02-29 14:40:22 -08:00
2 changed files with 32 additions and 2 deletions

View File

@@ -67,12 +67,12 @@ RestWrite.prototype.execute = function() {
return this.handleInstallation();
}).then(() => {
return this.handleSession();
}).then(() => {
return this.validateAuthData();
}).then(() => {
return this.runBeforeTrigger();
}).then(() => {
return this.setRequiredFieldsIfNeeded();
}).then(() => {
return this.validateAuthData();
}).then(() => {
return this.transformUser();
}).then(() => {
@@ -136,6 +136,10 @@ RestWrite.prototype.validateSchema = function() {
// Runs any beforeSave triggers against this operation.
// Any change leads to our data being mutated.
RestWrite.prototype.runBeforeTrigger = function() {
if (this.response) {
return;
}
// Avoid doing any setup for triggers if there is no 'beforeSave' trigger for this class.
if (!triggers.triggerExists(this.className, triggers.Types.beforeSave, this.config.applicationId)) {
return Promise.resolve();