blob: fe674adfb5ed7133fbaa7fcddb64234e7f650c8d (
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
|
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();
$("body").addClass("login");
},
showErrors: function (err) {
$(".errors").show().css({ opacity: 1 }).html("Bad username/password combo");
},
success: function (data) {
console.log("LOGGED IN?", data);
console.log(data.user);
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 = is_mobile ? "/stream" : "/index";
}
},
});
|