"Finish" Working on backend

This commit is contained in:
Astatin3
2024-01-22 17:04:09 -07:00
parent ad431dd4da
commit 0ea56990de
11 changed files with 197 additions and 101 deletions
+9 -7
View File
@@ -26,12 +26,12 @@ export function authClient(rawClient) {
}
this.clidata = (data)=>{
// const session = utils.getCookie('session')
// if(session != ''){
// this.rawClient.send('reauth', {
// session: session
// })
// }
const session = utils.getCookie('session')
if(session != ''){
this.rawClient.send('reauth', {
session: session
})
}
}
this.loginSuccess = (data)=>{
@@ -45,7 +45,9 @@ export function authClient(rawClient) {
}
this.reauth = (data)=>{
utils.popupSuccess('Connection', 'Successfully logged in!')
if(window.location.pathname == "/login"){
utils.popupSuccess('Connection', 'Successfully logged in!')
}
utils.iconauth()
}
+21 -1
View File
@@ -21,4 +21,24 @@ window.authClient = client
window.authLogin = client.login
window.sendAuth = client.send
window.sendRaw = rawClient.send
window.addRawTypeListener = rawClient.addRawTypeListener
window.addListener = rawClient.addRawTypeListener
window.addListener('popupInfo', (data)=>{
window.utils.popupInfo(data.data.title, data.data.msg)
})
window.addListener('popupSuccess', (data)=>{
window.utils.popupSuccess(data.data.title, data.data.msg)
})
window.addListener('popupWarning', (data)=>{
window.utils.popupWarning(data.data.title, data.data.msg)
})
window.addListener('popupError', (data)=>{
window.utils.popupError(data.data.title, data.data.msg)
})
window.addListener('popupColor', (data)=>{
window.utils.addPopup(data.data.color, data.data.isDark, data.data.title, data.data.msg)
})
+1
View File
@@ -11,6 +11,7 @@ function getErrorDesc(error){
case 'invalidLogin':
return 'Invalid username or password'
case 'invalidLoginRequest':
utils.setCookie('session', '')
return 'Some part of the login request is invalid, please try again'
case 'prelogin':
return 'You are already logged in'
+3
View File
@@ -202,6 +202,7 @@ li::marker {
width: var(--popupBoxWidth);
height: calc(100% - var(--topnavheight) - 10px);
pointer-events:none;
bottom: 0;
right: 20px;
overflow: auto;
@@ -224,6 +225,8 @@ li::marker {
padding: 0;
background-color: inherit;
pointer-events:all;
left: 0;
margin: 0;
margin-bottom: 20px;
+2 -1
View File
@@ -64,7 +64,7 @@ export function iconauth() {
// }
function addPopup(bgcolor, isDark, title, content) {
export function addPopup(bgcolor, isDark, title, content) {
const elem = document.getElementById('popupBox')
let header
let textColor
@@ -105,6 +105,7 @@ export function popupError(title, text){
addPopup('#500000', true, title, text)
}
export function getUnixTime() {
return (+ new Date())
}