mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
start
Done so far Basic backend skeleton - technology choices - database migration outline - basic self hosting facade - basic REST outline - proof of concept for auth and privileges Basic frontend skeleton - technology choices - pretty robust frontend compilation - top navigation - proof of concept for registration form
This commit is contained in:
34
static/js/controllers/auth_controller.js
Normal file
34
static/js/controllers/auth_controller.js
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
class AuthController {
|
||||
constructor(topNavigationController) {
|
||||
this.topNavigationController = topNavigationController;
|
||||
this.currentUser = null;
|
||||
}
|
||||
|
||||
isLoggedIn() {
|
||||
return this.currentUser !== null;
|
||||
}
|
||||
|
||||
hasPrivilege() {
|
||||
return true;
|
||||
}
|
||||
|
||||
login(user) {
|
||||
this.currentUser = user;
|
||||
}
|
||||
|
||||
logout(user) {
|
||||
this.currentUser = null;
|
||||
}
|
||||
|
||||
loginRoute() {
|
||||
this.topNavigationController.activate('login');
|
||||
}
|
||||
|
||||
logoutRoute() {
|
||||
this.topNavigationController.activate('logout');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AuthController;
|
Reference in New Issue
Block a user