snappymail/dev/App/Admin.js

33 lines
789 B
JavaScript
Raw Normal View History

2021-01-26 18:46:30 +08:00
import 'External/Admin/ko';
2015-11-19 01:32:29 +08:00
2021-03-10 18:44:48 +08:00
import { Settings, SettingsGet } from 'Common/Globals';
2015-11-19 01:32:29 +08:00
import Remote from 'Remote/Admin/Fetch';
2015-11-19 01:32:29 +08:00
2019-07-05 03:19:24 +08:00
import { SettingsAdminScreen } from 'Screen/Admin/Settings';
import { LoginAdminScreen } from 'Screen/Admin/Login';
2016-07-07 07:11:13 +08:00
2020-09-17 05:19:34 +08:00
import { startScreens } from 'Knoin/Knoin';
2019-07-05 03:19:24 +08:00
import { AbstractApp } from 'App/Abstract';
2015-11-19 01:32:29 +08:00
2019-07-05 03:19:24 +08:00
class AdminApp extends AbstractApp {
2016-07-16 05:29:42 +08:00
constructor() {
2015-11-19 01:32:29 +08:00
super(Remote);
2021-03-16 21:15:05 +08:00
this.weakPassword = ko.observable(false);
2015-11-19 01:32:29 +08:00
}
start() {
2021-03-10 18:44:48 +08:00
if (!Settings.app('allowAdminPanel')) {
rl.route.root();
setTimeout(() => location.href = '/', 1);
2021-03-16 21:15:05 +08:00
} else if (SettingsGet('Auth')) {
this.weakPassword(!!SettingsGet('WeakPassword'));
startScreens([SettingsAdminScreen]);
2019-07-05 03:19:24 +08:00
} else {
2021-03-16 21:15:05 +08:00
startScreens([LoginAdminScreen]);
2015-11-19 01:32:29 +08:00
}
}
}
2016-06-17 07:23:49 +08:00
export default new AdminApp();