Compare commits

...

2 commits

Author SHA1 Message Date
Bad
c8351e8f0c Warn when assuming https
All checks were successful
continuous-integration/drone/push Build is passing
2020-10-21 19:43:21 +02:00
Bad
cf2c691585 Make font feedback red on error 2020-10-21 19:41:19 +02:00
2 changed files with 14 additions and 8 deletions

View file

@ -50,12 +50,12 @@ class Feedback extends ElemJS {
this.loading = state this.loading = state
} }
message(content) { message(content, isError) {
if (content) { this.removeClass("form-feedback")
this.class("form-feedback") this.removeClass("form-error")
} else { if (content) this.class("form-feedback")
this.removeClass("form-feedback") if(isError) this.class("form-error")
}
this.messageSpan.text(content) this.messageSpan.text(content)
} }
} }
@ -80,7 +80,10 @@ class Form extends ElemJS {
let currentAddress = homeserver.value let currentAddress = homeserver.value
let ok = false let ok = false
while (!ok) { 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(/\/*$/, "") currentAddress = currentAddress.replace(/\/*$/, "")
this.status(`Looking up homeserver... trying ${currentAddress}`) this.status(`Looking up homeserver... trying ${currentAddress}`)
try { try {
@ -141,7 +144,7 @@ class Form extends ElemJS {
cancel(message) { cancel(message) {
this.processing = false this.processing = false
feedback.setLoading(false) feedback.setLoading(false)
feedback.message(message) feedback.message(message, true)
} }
} }

View file

@ -38,6 +38,9 @@
width: 100% width: 100%
margin: -0.5em 0 -0.8em margin: -0.5em 0 -0.8em
.form-error
color: red
@keyframes spin @keyframes spin
0% 0%
transform: rotate(0deg) transform: rotate(0deg)