summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views')
-rw-r--r--public/assets/js/lib/views/details/comments.js1
-rw-r--r--public/assets/js/lib/views/login/login.js18
2 files changed, 14 insertions, 5 deletions
diff --git a/public/assets/js/lib/views/details/comments.js b/public/assets/js/lib/views/details/comments.js
index 65473c6..5d99138 100644
--- a/public/assets/js/lib/views/details/comments.js
+++ b/public/assets/js/lib/views/details/comments.js
@@ -26,7 +26,6 @@ var CommentsView = FormView.extend({
.replace(/{{comment}}/g, tidy_urls(comment.comment))
.replace(/{{date}}/g, datetime[0])
.replace(/{{time}}/g, datetime[1])
- console.log(t)
var $t = $(t)
return $t
},
diff --git a/public/assets/js/lib/views/login/login.js b/public/assets/js/lib/views/login/login.js
index 90c1b67..48676e9 100644
--- a/public/assets/js/lib/views/login/login.js
+++ b/public/assets/js/lib/views/login/login.js
@@ -2,20 +2,30 @@ var LoginView = FormView.extend({
el: "#login",
action: "/api/login",
- method: "POST",
+ method: "put",
initialize: function(opt){
this.__super__.initialize.call(this)
+ $("body").removeClass("loading")
this.$("[name=username]").focus()
},
- showErrors: function(errors){
- console.log(errors)
+ showErrors: function(err){
+ $(".errors").show().css({ opacity: 1 }).html("Bad username/password combo")
},
success: function(data){
+ console.log("LOGGED IN?", data)
+ if (data.user) {
+ auth.set_user(data.user)
+ }
+ else {
+ this.showErrors()
+ return
+ }
if (data.returnTo) {
- window.location.href = "/index"
+ console.log(data.returnTo)
+ window.location.href = data.returnTo
}
else {
window.location.href = "/index"