Skip to content

Commit 490b704

Browse files
committed
add option to override exam mode
useful for admins / IT personnel
1 parent 14e72a9 commit 490b704

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

client/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@ async function initGreeter(): Promise<void> {
5151
// Add reboot keybind to reboot on ctrl+alt+del
5252
// only when the lock screen is not shown
5353
document.addEventListener('keydown', (e) => {
54+
// Ctrl + Alt + Delete = reboot computer
5455
if (e.ctrlKey && e.altKey && e.code === 'Delete' && !window.ui.isLockScreen) {
56+
window.ui.setDebugInfo('Reboot requested through LightDM');
5557
window.restartComputer();
5658
}
59+
// Ctrl + Alt + E = override exam mode
60+
if (e.ctrlKey && e.altKey && e.code === 'KeyE' && !window.ui.isLockScreen) {
61+
window.ui.setDebugInfo('Exam mode override enabled');
62+
window.ui.overrideExamMode();
63+
}
5764
});
5865
}
5966

client/ui.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class UI {
1717
private _loginScreen: LoginScreenUI | null = null;
1818
private _examModeScreen: ExamModeUI | null = null;
1919
private _isLockScreen: boolean = false;
20+
private _examModeDisabled: boolean = false; // Used to disable exam mode in case of admin override
2021
private _wallpaper: WallpaperUI;
2122
private _calendar: CalendarUI;
2223
private _logo: HTMLImageElement;
@@ -81,6 +82,14 @@ export class UI {
8182
return this._isLockScreen;
8283
}
8384

85+
/**
86+
* Override the exam mode and show the regular login screen. Useful for admins who need to debug.
87+
*/
88+
public overrideExamMode(): void {
89+
this._examModeDisabled = true;
90+
this.checkForExamMode();
91+
}
92+
8493
public setDebugInfo(info: string): void {
8594
this._infoBars.setDebugInfo(info);
8695
}
@@ -129,7 +138,7 @@ export class UI {
129138
return now >= beginExamModeAt && now < endAt;
130139
});
131140

132-
if (ongoingExams.length > 0) {
141+
if (!this._examModeDisabled && ongoingExams.length > 0) {
133142
// Only set exam mode if the exam that is starting soon is not already in the list of exam ids displayed in exam mode
134143
if (!this._examModeScreen?.examMode || !ongoingExams.some((exam) => this._examModeScreen?.examIds.includes(exam.id))) {
135144
console.log("Activating exam mode login UI");

0 commit comments

Comments
 (0)