summaryrefslogtreecommitdiff
path: root/public/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js')
-rw-r--r--public/assets/js/lib/views/login/login.js48
1 files changed, 22 insertions, 26 deletions
diff --git a/public/assets/js/lib/views/login/login.js b/public/assets/js/lib/views/login/login.js
index 6e810d6..fe674ad 100644
--- a/public/assets/js/lib/views/login/login.js
+++ b/public/assets/js/lib/views/login/login.js
@@ -1,37 +1,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")
+
+ 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")
+
+ 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)
+
+ success: function (data) {
+ console.log("LOGGED IN?", data);
+ console.log(data.user);
if (data.user) {
- auth.set_user(data.user)
- }
- else {
- this.showErrors()
- return
+ 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"
+ console.log(data.returnTo);
+ window.location.href = data.returnTo;
+ } else {
+ window.location.href = is_mobile ? "/stream" : "/index";
}
},
-
-})
+});