mirror of
https://github.com/Astatin3/Polyboard.git
synced 2026-06-09 00:28:07 -06:00
Update - still working
This commit is contained in:
@@ -1 +0,0 @@
|
||||
<p>Test123123!</p>
|
||||
@@ -0,0 +1,11 @@
|
||||
<p>Test!</p>
|
||||
<button id="testButton" onclick="testFunc()">test!</button>
|
||||
<script>
|
||||
function getel(el) {return document.getElementById(el)}
|
||||
|
||||
function testFunc() {
|
||||
window.sendRaw('test1', {
|
||||
data: 'test!'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
+34
-5
@@ -1,14 +1,43 @@
|
||||
from modules.main import test as test
|
||||
|
||||
mm = None
|
||||
|
||||
def test1(ac, data):
|
||||
mm.sendPopupColor(ac.rawClient, 'test!', 'test!', '#600060', True)
|
||||
def logout(ac, data):
|
||||
ac.send('redir', {
|
||||
"location": "/"
|
||||
})
|
||||
mm.authServer.unauth(ac)
|
||||
|
||||
def loadSessions(ac):
|
||||
obj = []
|
||||
for client in mm.authServer.clients:
|
||||
if client.user != ac.user:
|
||||
continue
|
||||
obj.append({
|
||||
'username': client.username,
|
||||
'address': client.rawClient.address,
|
||||
'currentPage': client.currentPage,
|
||||
'clientid': client.rawClient.clientid,
|
||||
'timeout': client.timeout
|
||||
})
|
||||
# obj.append(client.session)
|
||||
ac.send('sessions', obj)
|
||||
|
||||
def unauth(ac, data):
|
||||
removeClient = mm.getAuthClientByID(data['data'])
|
||||
if removeClient == None:
|
||||
return
|
||||
if removeClient.user == ac.user:
|
||||
removeClient.send('redir', {
|
||||
"location": "/"
|
||||
})
|
||||
mm.unauth(removeClient)
|
||||
loadSessions(ac)
|
||||
|
||||
def init(moduleMaster):
|
||||
global mm
|
||||
mm = moduleMaster
|
||||
mm.addAuthEventListener('test1', test1)
|
||||
mm.addAuthEventListener('logout', logout)
|
||||
mm.addAuthEventListener('unauth', unauth)
|
||||
mm.addPageEventListener('/main/User', loadSessions)
|
||||
|
||||
def main():
|
||||
pass
|
||||
+15
-12
@@ -11,27 +11,30 @@
|
||||
{
|
||||
"type": "page",
|
||||
"name": "dashboard",
|
||||
"requiredPermGroup": "",
|
||||
"location": "modules/main/Dashboard.html"
|
||||
},
|
||||
{
|
||||
"type": "folder",
|
||||
"name": "folder 1",
|
||||
"name": "Settings",
|
||||
"pages": [
|
||||
{
|
||||
"type": "page",
|
||||
"name": "dashboardcopy",
|
||||
"location": "modules/main/Dashboard-copy.html"
|
||||
"name": "User",
|
||||
"requiredPermGroup": "",
|
||||
"location": "modules/main/userSettings.html"
|
||||
},
|
||||
{
|
||||
"type": "folder",
|
||||
"name": "folder 2",
|
||||
"pages": [
|
||||
{
|
||||
"type": "page",
|
||||
"name": "dashboardcopy",
|
||||
"location": "modules/main/Dashboard-copy.html"
|
||||
}
|
||||
]
|
||||
"type": "page",
|
||||
"name": "Program",
|
||||
"requiredPermGroup": "Admin",
|
||||
"location": "modules/main/programSettings.html"
|
||||
},
|
||||
{
|
||||
"type": "page",
|
||||
"name": "Admin",
|
||||
"requiredPermGroup": "Admin",
|
||||
"location": "modules/main/adminSettings.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<p>Test!</p>
|
||||
<button id="testButton" onclick="testFunc()">test!</button>
|
||||
<script>
|
||||
function getel(el) {return document.getElementById(el)}
|
||||
|
||||
function testFunc() {
|
||||
window.sendRaw('test1', {
|
||||
data: 'test!'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -1,2 +0,0 @@
|
||||
def test():
|
||||
return "testsjdhgkjrhsgkhjertestsjdhgkjrhsgkhjertestsjdhgkjrhsgkhjer"
|
||||
@@ -0,0 +1,86 @@
|
||||
<main class="container">
|
||||
<h3>User Settings</h3>
|
||||
<p>Sessions</p>
|
||||
<table role="grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Username</th>
|
||||
<th scope="col">Address</th>
|
||||
<th scope="col">Path</th>
|
||||
<th scope="col">Expires</th>
|
||||
<th scope="col">Remove</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sessionTable"></tbody>
|
||||
</table>
|
||||
<button id="changePassword" onclick="changePassword()">Change Password</button>
|
||||
<button id="logoutButton" onclick="promptLogout()">Logout</button>
|
||||
</main>
|
||||
<script>
|
||||
function promptLogout() {
|
||||
utils.confirmBox('var(--card-sectionning-background-color)', true, 'Are you sure you want to log out?', 'logout()', '')
|
||||
}
|
||||
|
||||
function promptUnauth(clientid) {
|
||||
utils.confirmBox('var(--card-sectionning-background-color)', true, 'Are you sure you want to log this session out?', `unauthClient('${clientid}')`, '')
|
||||
}
|
||||
|
||||
function logout() {
|
||||
window.sendRaw('logout', {})
|
||||
utils.setCookie('session', '')
|
||||
}
|
||||
|
||||
function unauthClient(id) {
|
||||
window.sendRaw('unauth', id)
|
||||
}
|
||||
|
||||
function changePassword() {
|
||||
const elem = document.body
|
||||
const bgcolor = 'var(--card-sectionning-background-color)'
|
||||
const header = 'rgba(255,255,255,0.05)'
|
||||
const textColor = 'text-white'
|
||||
const title = "Change password"
|
||||
|
||||
utils.modal(elem, 'document.body',bgcolor, header, textColor, title, `
|
||||
<input type="password" placeholder="Old Password"></input>
|
||||
<input type="password" placeholder="New Password"></input>
|
||||
<input type="password" placeholder="Retype new Password"></input>
|
||||
<button>Submit</button>`)
|
||||
}
|
||||
|
||||
window.main = ()=>{
|
||||
|
||||
const sessionTable = document.getElementById('sessionTable')
|
||||
|
||||
window.addListener("sessions", (data)=>{
|
||||
sessions = data.data
|
||||
let html = ""
|
||||
for(let i=0;i<sessions.length;i++){
|
||||
html += `
|
||||
<tr>
|
||||
<td>${sessions[i].username}</td>
|
||||
<td>${sessions[i].address}</td>
|
||||
<td>${sessions[i].currentPage}</td>
|
||||
<td>${utils.formatTime(sessions[i].timeout)}</td>
|
||||
<td><a href="#" onclick="promptUnauth('${sessions[i].clientid}')">Logout</a></td>
|
||||
</tr>
|
||||
`
|
||||
}
|
||||
sessionTable.innerHTML = html
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<!--
|
||||
#################################################
|
||||
New Credentials - THESE ONLY WILL BE PRINTED ONCE
|
||||
########
|
||||
Username: User
|
||||
Password: 67FFCdfb9dB827fB
|
||||
########
|
||||
Username: Admin
|
||||
Password: eB0BB402900DfE5A
|
||||
#################################################
|
||||
-->
|
||||
Reference in New Issue
Block a user