var SignInModal = ModalView.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('