From 7f423630728bccf4798a7435ea31fa0a17231bb0 Mon Sep 17 00:00:00 2001 From: swee Date: Tue, 21 Jan 2025 20:16:48 -0800 Subject: [PATCH] Update modules/sqlite_local.py --- modules/sqlite_local.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/sqlite_local.py b/modules/sqlite_local.py index da337f8..2dbe691 100644 --- a/modules/sqlite_local.py +++ b/modules/sqlite_local.py @@ -12,7 +12,7 @@ class broker: self.fnet = Fernet(fernet_key) db = self.conn.cursor() db.execute("""CREATE table IF NOT EXISTS bans (ip varchar(255), reason varchar(255))""") - db.execute("""CREATE table IF NOT EXISTS nickserv (user varchar(255), modes varchar(255), hash varchar(255), cloak varchar(255))""") + db.execute("""CREATE table IF NOT EXISTS nickserv (user varchar(255), modes varchar(255), hash varchar(255), cloak varchar(255), email varchar(255))""") db.execute("""CREATE table IF NOT EXISTS groups (name varchar(255), owner varchar(255))""") db.execute("""CREATE table IF NOT EXISTS chanserv (name varchar(255), modes varchar(255), params varchar(255), owner varchar(255), usermodes varchar(255), optimodes varchar(255))""") def nickserv_identify(self, nick, password:str): @@ -26,4 +26,8 @@ class broker: return e[0] if self.fnet.decrypt(e[0][2]) == password else False except: print(traceback.format_exc()) - return False \ No newline at end of file + return False + def nickserv_register(self, nick, password, email): + hashed = self.fnet.encrypt(password).decode() + db = self.conn.cursor() + db.execute("INSERT INTO nickserv values(?, 'iw', ?, ?, ?);", [nick, hashed, f"user/{nick}", email]) \ No newline at end of file