blob: 48676e9e9d85abcd53d66b77fe2e716d5bd8d731 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
var LoginView = FormView.extend({
el: "#login",
action: "/api/login",
method: "put",
initialize: function(opt){
this.__super__.initialize.call(this)
$("body").removeClass("loading")
this.$("[name=username]").focus()
},
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) {
console.log(data.returnTo)
window.location.href = data.returnTo
}
else {
window.location.href = "/index"
}
},
})
|