diff --git a/src/js/login.js b/src/js/login.js index de32932..33d2006 100644 --- a/src/js/login.js +++ b/src/js/login.js @@ -50,12 +50,12 @@ class Feedback extends ElemJS { this.loading = state } - message(content) { - if (content) { - this.class("form-feedback") - } else { - this.removeClass("form-feedback") - } + message(content, isError) { + this.removeClass("form-feedback") + this.removeClass("form-error") + if (content) this.class("form-feedback") + if(isError) this.class("form-error") + this.messageSpan.text(content) } } @@ -80,7 +80,10 @@ class Form extends ElemJS { let currentAddress = homeserver.value let ok = false while (!ok) { - if (!currentAddress.match(/^https?:\/\//)) currentAddress = "https://" + currentAddress + if (!currentAddress.match(/^https?:\/\//)) { + console.warn(`${currentAddress} doesn't specify the protocol, assuming https`) + currentAddress = "https://" + currentAddress + } currentAddress = currentAddress.replace(/\/*$/, "") this.status(`Looking up homeserver... trying ${currentAddress}`) try { @@ -141,7 +144,7 @@ class Form extends ElemJS { cancel(message) { this.processing = false feedback.setLoading(false) - feedback.message(message) + feedback.message(message, true) } } diff --git a/src/sass/login.sass b/src/sass/login.sass index e4820ee..235fad4 100644 --- a/src/sass/login.sass +++ b/src/sass/login.sass @@ -38,6 +38,9 @@ width: 100% margin: -0.5em 0 -0.8em +.form-error + color: red + @keyframes spin 0% transform: rotate(0deg)