snappymail/dev/App/Admin.js
2022-10-10 13:52:56 +02:00

36 lines
854 B
JavaScript

import 'External/ko';
import { Settings, SettingsGet } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
import Remote from 'Remote/Admin/Fetch';
import { SettingsAdminScreen } from 'Screen/Admin/Settings';
import { LoginAdminScreen } from 'Screen/Admin/Login';
import { startScreens } from 'Knoin/Knoin';
import { AbstractApp } from 'App/Abstract';
export class AdminApp extends AbstractApp {
constructor() {
super(Remote);
this.weakPassword = ko.observable(false);
}
refresh() {
ThemeStore.populate();
this.start();
}
start() {
if (!Settings.app('adminAllowed')) {
rl.route.root();
setTimeout(() => location.href = '/', 1);
} else if (SettingsGet('Auth')) {
this.weakPassword(SettingsGet('WeakPassword'));
startScreens([SettingsAdminScreen]);
} else {
startScreens([LoginAdminScreen]);
}
}
}