diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-09-03 16:35:07 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-09-03 16:35:07 -0400 |
| commit | 976bdace6704b60bc984635917ee56f17797c10a (patch) | |
| tree | f2451b3f23c87d3e14c1eb8e3d92cda321db8103 /public/assets/js/lib | |
| parent | f768ab296c07ce93efe9f2507cdf4b795aa10013 (diff) | |
able to log in
Diffstat (limited to 'public/assets/js/lib')
| -rw-r--r-- | public/assets/js/lib/router.js | 9 | ||||
| -rw-r--r-- | public/assets/js/lib/views/login/login.js | 26 |
2 files changed, 21 insertions, 14 deletions
diff --git a/public/assets/js/lib/router.js b/public/assets/js/lib/router.js index 30646c1..5bc05c3 100644 --- a/public/assets/js/lib/router.js +++ b/public/assets/js/lib/router.js @@ -5,19 +5,14 @@ var SiteRouter = Router.extend({ el: "body", routes: { - "/": 'lobby', + "/": 'login', "/index": 'index', "/login": 'login', "/details/:id": 'room', }, initialize: function(){ - if (! user.username) { - app.view = new LoginView() - } - else { - this.route() - } + this.route() }, index: function(){ 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 +}) |
