From 976bdace6704b60bc984635917ee56f17797c10a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 3 Sep 2015 16:35:07 -0400 Subject: able to log in --- public/assets/js/lib/views/login/login.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'public/assets/js/lib/views') diff --git a/public/assets/js/lib/views/login/login.js b/public/assets/js/lib/views/login/login.js index 06d8808..a48b404 100644 --- a/public/assets/js/lib/views/login/login.js +++ b/public/assets/js/lib/views/login/login.js @@ -1,14 +1,26 @@ var LoginView = FormView.extend({ - - events: { - }, + + el: "#login", + action: "/api/login", + method: "POST", initialize: function(opt){ - // opt.parent = parent + this.__super__.initialize.call(this) + this.$("[name=username]").focus() + }, + + showErrors: function(errors){ + console.log(errors) }, - success: function(){ - window.location.href = "/index" + success: function(data){ + console.log(data) + if (data.returnTo) { + window.location.href = "/index" + } + else { + window.location.href = "/index" + } }, -}) \ No newline at end of file +}) -- cgit v1.2.3-70-g09d2