stranck-dev #10

Merged
drew merged 14 commits from stranck-dev into drew-dev 2024-01-13 16:02:42 +00:00
4 changed files with 6 additions and 4 deletions
Showing only changes of commit c82d075913 - Show all commits

2
ext.py
View File

@ -119,7 +119,7 @@ class Order:
self.pending_room = self.ans('pending_room') self.pending_room = self.ans('pending_room')
self.pending_roommates = self.ans('pending_roommates').split(',') if self.ans('pending_roommates') else [] self.pending_roommates = self.ans('pending_roommates').split(',') if self.ans('pending_roommates') else []
self.room_members = self.ans('room_members').split(',') if self.ans('room_members') else [] self.room_members = self.ans('room_members').split(',') if self.ans('room_members') else []
self.room_owner = (self.code == self.room_id) self.room_owner = (self.code is not None and self.room_id is not None and self.code.strip() == self.room_id.strip())
self.room_secret = self.ans('room_secret') self.room_secret = self.ans('room_secret')
self.app_token = self.ans('app_token') self.app_token = self.ans('app_token')
self.nfc_id = self.ans('nfc_id') self.nfc_id = self.ans('nfc_id')

View File

@ -7,7 +7,8 @@ function confirmAction (intent, sender) {
let intentFormAction = document.querySelector("#intentFormAction") let intentFormAction = document.querySelector("#intentFormAction")
let intentSend = document.querySelector("#intentSend") let intentSend = document.querySelector("#intentSend")
// Resetting ui // Resetting ui
intentEdit.setAttribute('required', false) intentEdit.removeAttribute('required')
intentEdit.removeAttribute('minlength')
intentFormAction.setAttribute('method', 'GET') intentFormAction.setAttribute('method', 'GET')
intentEditPanel.style.display = 'none'; intentEditPanel.style.display = 'none';
@ -17,6 +18,7 @@ function confirmAction (intent, sender) {
case 'rename': case 'rename':
intentEditPanel.style.display = 'block'; intentEditPanel.style.display = 'block';
intentEdit.setAttribute('required', true) intentEdit.setAttribute('required', true)
intentEdit.setAttribute('minlength', 4)
intentFormAction.setAttribute('method', 'POST') intentFormAction.setAttribute('method', 'POST')
document.getElementById("intentRename").value = sender.parentElement.parentElement.querySelector("span").innerText; document.getElementById("intentRename").value = sender.parentElement.parentElement.querySelector("span").innerText;
break break

View File

@ -49,7 +49,7 @@ async def delete_room(request, order: Order):
if not order: if not order:
raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!") raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!")
if order.room_owner: if not order.room_owner:
raise exceptions.BadRequest("You are not allowed to delete room of others.") raise exceptions.BadRequest("You are not allowed to delete room of others.")
if order.ans('room_confirmed'): if order.ans('room_confirmed'):

View File

@ -114,7 +114,7 @@
<p id="intentDescription"></p> <p id="intentDescription"></p>
<div id="intentEditPanel"> <div id="intentEditPanel">
<label for="name">Enter a new room name</label> <label for="name">Enter a new room name</label>
<input id="intentRename" name="name" type="text" value="" minlength="4" maxlength="64"/> <input id="intentRename" name="name" type="text" value="" maxlength="64"/>
</div> </div>
<footer> <footer>
<input id="intentSend" type="submit" value="Confirm" /> <input id="intentSend" type="submit" value="Confirm" />