diff options
| author | Julie Lala <jules@okfoc.us> | 2014-06-09 07:48:34 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-06-09 07:48:34 -0400 |
| commit | e8ba718205d41e75923264ef945178030b662c93 (patch) | |
| tree | 97bff0c0ec0a2bd2b6efb7d5ddbb1ff60c102529 /public/assets/javascripts/ui/SignInModal.js | |
| parent | d385f80d0942494410432f11d3f3ca0f05d9e4a9 (diff) | |
populate edit profile form
Diffstat (limited to 'public/assets/javascripts/ui/SignInModal.js')
| -rw-r--r-- | public/assets/javascripts/ui/SignInModal.js | 49 |
1 files changed, 3 insertions, 46 deletions
diff --git a/public/assets/javascripts/ui/SignInModal.js b/public/assets/javascripts/ui/SignInModal.js index 0112513..4c91b54 100644 --- a/public/assets/javascripts/ui/SignInModal.js +++ b/public/assets/javascripts/ui/SignInModal.js @@ -1,54 +1,11 @@ -var SignInModal = ModalView.extend({ +var SignInModal = ModalFormView.extend({ el: ".mediaDrawer.signin", action: "/auth/signin", - events: { - "submit form": "submit" - }, - - initialize: function(){ - this.$form = this.$("form") - this.$errors = this.$(".errors") - this.$errorList = this.$(".errorList") - }, - - reset: function(){ - this.$("input").not("[type='submit']").not("[type='hidden']").val("") - }, - - load: function(){ - this.reset() - this.show() - }, - - submit: function(e){ - e.preventDefault() - - this.$errors.hide(); - this.$errorList.empty() - - var fields = this.$form.serializeArray() - fields.forEach(function(pair){ - if (pair.name == "password" && pair.value.length > 0) { - pair.value = SHA1.hex('lol$' + pair.value + '$vvalls') - } - }) - - var request = $.post(this.action, $.param(fields)); - request.done($.proxy(function (response) { - if (response.error) { - this.$errors.show(); - for (var key in response.error.errors) { - this.$errorList.append('<div>' + response.error.errors[key].message + '</div>'); - } - return - } - else { - window.location.href = "/profile" - } - }, this)); + success: function(res){ + window.location.href = "/profile" } }) |
