Skip to content

Commit b024aa8

Browse files
committed
Fixed #121
1 parent 75eb96e commit b024aa8

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ __pycache__/
44
*.sqlite
55
*.key
66
/.project
7+
/.pydevproject

HardwareCheckout/auth.py

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ async def post(self):
7171
try:
7272
name = self.get_argument("name")
7373
password = self.get_argument("password")
74+
ctf = self.get_argument("ctf")
7475
except MissingArgumentError:
7576
return self.render("signup.html", messages="Missing username or password")
7677

@@ -87,6 +88,7 @@ async def post(self):
8788
# Create the new user entry
8889
new_user = User(
8990
name=name,
91+
ctf=ctf,
9092
password=generate_password_hash(password, method="pbkdf2:sha256:45000"),
9193
roles=[roles],
9294
)

HardwareCheckout/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ async def updateQueues(cls):
6262
'''
6363
with make_session() as session:
6464
cls.RWTerminals = await as_future(session.query(User.name, DeviceQueue.webUrl).join(User.deviceQueueEntry).filter_by(state="in-use").all)
65-
cls.ROTerminals = await as_future(session.query(User.name, DeviceQueue.roUrl).join(User.deviceQueueEntry).filter_by(state="in-use").all)
65+
cls.ROTerminals = await as_future(session.query(User.name, DeviceQueue.roUrl).join(User.deviceQueueEntry).filter_by(state="in-use",ctf=1).all)
6666
cls.queues = await as_future(session.query(DeviceType.id, DeviceType.name, func.count(UserQueue.userId)).select_from(DeviceType).join(UserQueue, isouter=True).group_by(DeviceType.id, DeviceType.name).all)

HardwareCheckout/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class User(db.Model):
2222
__tablename__ = "user"
2323
id = Column(Integer, primary_key=True)
2424
password = Column(String(93), unique=True)
25+
ctf = Column(Integer)
2526
name = Column(String(1000))
2627

2728
# relationships

HardwareCheckout/templates/login.html

-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222
<input class="input is-large" type="password" name="password" placeholder="Your Password">
2323
</div>
2424
</div>
25-
<div class="field">
26-
<label class="checkbox">
27-
<input type="checkbox">
28-
Remember me
29-
</label>
30-
</div>
3125
<button class="button is-block is-large is-fullwidth">Login</button>
3226
</form>
3327
</div>

HardwareCheckout/templates/signup.html

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
<input class="input is-large" type="password" name="password" placeholder="Password">
2424
</div>
2525
</div>
26+
<div class="field">
27+
<label class="checkbox">
28+
<input type="checkbox" name="ctf">
29+
CTF User
30+
</label>
31+
</div>
2632

2733
<button class="button is-block is-large is-fullwidth">Sign Up</button>
2834
</form>

0 commit comments

Comments
 (0)