-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListFilesRegistration.py
31 lines (23 loc) · 1.06 KB
/
ListFilesRegistration.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
# -*- coding:utf-8 -*-
from database import Database
from Registration import Registration
import network
import messages
class ListFilesRegistration(Registration) :
def __init__(self, key, users) :
Registration.__init__(self, key, users)
self.database = Database()
def run(self, body, socket) :
messages.begin_registration(self.key, socket)
username = body["content"]["username"]
password = body["content"]["password"]
if username not in self.users or self.users[username] != password:
status = "0000"
content = "ERROR: The server had problems with the user identification, please try log in again."
messages.end_registration(self.key, socket, content)
else :
content = self.database.get_list_files(username)
status = "1025"
messages.end_registration(self.key, socket, "SUCCESS: The user list files was sended successfully.")
msg = self.ack_construct(content, status, self.response_type)
network.send(socket, msg)