var PasswordReset = ModalFormView.extend({ el: ".mediaDrawer.passwordReset", action: "/auth/password", load: function(){ var opt = JSON.parse( $("#opt").html() ) this.$("[name=nonce]").val( opt.nonce ) this.__super__.load.call(this) }, validate: function(){ var errors = [] var pw1 = this.$("#passwordInput1").val() var pw2 = this.$("#passwordInput2").val() if (! pw1.length) { errors.push("Please enter a password"); } if (pw1 !== pw2) { errors.push("Passwords don't match"); } return errors }, success: function(res){ window.location.href = "/profile" } })