forked from lunixbochs/uberserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LANUsers.py
executable file
·74 lines (57 loc) · 2.17 KB
/
LANUsers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import time
class LANUser:
def __init__(self, user, password, ip):
self.lowername = user.lower()
self.username = user
self.ingame_time = 0
self.access = 'user'
self.last_login = int(time.time())
self.register_date = int(time.time())
self.last_ip = ip
self.bot = False
self.hook_chars = ''
self.id = None
class UsersHandler:
def __init__(self, root, engine=None):
self._root = root
def clientFromID(self, db_id):
return self._root.clientFromID(db_id)
def clientFromUsername(self, username):
return self._root.clientFromUsername(username)
def login_user(self, user, password, ip, lobby_id, user_id, cpu, local_ip, country):
User = LANUser(user, password, ip)
lanadmin = self._root.lanadmin
if user.lower() == lanadmin['username'].lower():
if password == lanadmin['password']:
User.username = lanadmin['username']
User.access = 'admin'
else: return False, 'Bad username/password'
return True, User
def register_user(self, user, password, ip, country): # need to add better ban checks so it can check if an ip address is banned when registering an account :) << lolwut this is LAN server
good = user in self._root.usernames
return good, 'Account was not actually registered - we are in LAN mode ;).'
def rename_user(self, user, newname):
good = user in self._root.usernames
return good, 'Account was not actually renamed - we are in LAN mode ;).'
def get_registration_date(self, user):
return False, 'LAN mode and user not logged in.'
def save_user(self, *args, **kwargs): pass
def end_session(self, *args, **kwargs): pass
def get_ingame_time(self, *args, **kwargs):
return False, None
def get_lastlogin(self, *args, **kwargs):
return False, None
def get_account_info(self, *args, **kwargs):
return False, None
def get_account_access(self, *args, **kwargs):
return False, None
def find_ip(self, *args, **kwargs):
return False, None
def get_ip(self, *args, **kwargs):
return None
def ban_user(self, *args, **kwargs):
return False
def unban_user(self, *args, **kwargs):
return False
def banlist(self, *args, **kwargs):
return []