Skip to content

Commit c041ee6

Browse files
Silic0nS0ldieralexweissman
authored andcommitted
The actual fix for password resets from admin. (attributes were fetched too early)
1 parent e3e24fb commit c041ee6

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

app/sprinkles/core/assets/local/core/js/uf-form.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,11 @@
5353
this.element = element[0];
5454
this.$element = $(this.element);
5555
var lateDefaults = {
56-
reqParams: {
57-
type : this.$element.attr('method'),
58-
url : this.$element.attr('action')
59-
},
6056
encType : (typeof this.$element.attr('enctype') !== 'undefined') ? this.$element.attr('enctype') : '',
6157
msgTarget: this.$element.find('.js-form-alerts:first')
6258
};
6359
this.settings = $.extend(true, {}, defaults, lateDefaults, options);
64-
this._defaults = defaults;
60+
this._defaults = $.extend(true, {}, defaults, lateDefaults);
6561
this._name = pluginName;
6662

6763
// Detect changes to element attributes
@@ -90,19 +86,25 @@
9086
submitButton.html(this.settings.submittingText);
9187
}
9288

89+
// Get basic request parameters.
90+
var reqParams = {
91+
type: this.$element.attr('method'),
92+
url: this.$element.attr('action')
93+
};
94+
9395
// Get the form encoding type from the users HTML, and chose an encoding form.
9496
if (this.settings.encType.toLowerCase() === "multipart/form-data" ) {
95-
this.settings.reqParams.data = this._multipartData(form);
97+
reqParams.data = this._multipartData(form);
9698
// add additional params to fix jquery errors
97-
this.settings.reqParams.cache = false;
98-
this.settings.reqParams.contentType = false;
99-
this.settings.reqParams.processData = false;
99+
reqParams.cache = false;
100+
reqParams.contentType = false;
101+
reqParams.processData = false;
100102
} else {
101-
this.settings.reqParams.data = this._urlencodeData(form);
103+
reqParams.data = this._urlencodeData(form);
102104
}
103105

104106
// Submit the form via AJAX
105-
$.ajax(this.settings.reqParams).then(
107+
$.ajax(reqParams).then(
106108
// Submission successful
107109
$.proxy(function(data, textStatus, jqXHR) {
108110
// Restore button text and re-enable submit button

0 commit comments

Comments
 (0)