showing peer selector on login, minor login improvements

This commit is contained in:
mrfry 2023-04-27 08:07:16 +02:00
parent 9220466561
commit 2ee9731fdf

View file

@ -198,6 +198,7 @@
donate: 'Donate',
retry: 'Újra',
invalidPW: 'Hibás jelszó: ',
loggingIn: 'Belépés ...',
connecting: 'Csatlakozás: ',
connect: 'Csatlakozás',
login: 'Belépés',
@ -1653,6 +1654,9 @@
}
function Auth(pw) {
SafeGetElementById('infoMainDiv', (elem) => {
elem.innerText = texts.loggingIn
})
post('login', { pw: pw, script: true }).then((res) => {
if (res.result === 'success') {
infoExpireTime = -1
@ -1844,6 +1848,9 @@
SafeGetElementById('loginDiv', (elem) => {
elem.style.display = 'flex'
})
SafeGetElementById('peerSelector', (elem) => {
elem.style.display = ''
})
}
function addNewHost() {
@ -2734,6 +2741,36 @@
textAlign: 'center',
},
},
loginContainer: {
id: 'loginDiv',
style: {
display: 'none',
},
children: {
loginInput: {
customElem: () => {
const loginInput = document.createElement('input')
loginInput.setAttribute('id', 'pwInput')
loginInput.type = 'text'
loginInput.placeholder = texts.pwHere
SetStyle(loginInput, {
width: '100%',
textAlign: 'center',
})
return loginInput
},
},
loginButton: {
innerText: texts.login,
style: buttonStyle,
onClick: () => {
SafeGetElementById('pwInput', (elem) => {
Auth(elem.value.trim())
})
},
},
},
},
peerSelector: {
customElem: () => {
try {
@ -2782,36 +2819,6 @@
}
},
},
loginContainer: {
id: 'loginDiv',
style: {
display: 'none',
},
children: {
loginInput: {
customElem: () => {
const loginInput = document.createElement('input')
loginInput.setAttribute('id', 'pwInput')
loginInput.type = 'text'
loginInput.placeholder = texts.pwHere
SetStyle(loginInput, {
width: '100%',
textAlign: 'center',
})
return loginInput
},
},
loginButton: {
innerText: texts.login,
style: buttonStyle,
onClick: () => {
SafeGetElementById('pwInput', (elem) => {
Auth(elem.value)
})
},
},
},
},
hostInputContainer: {
id: 'hostInputContainer',
style: {