Registering works fine now

This commit is contained in:
florianuhlig
2025-10-03 01:23:18 +02:00
parent 823ea8cfc4
commit 70c85cb8be
10 changed files with 173 additions and 45 deletions

View File

@@ -1,5 +1,3 @@
db_name = "databases/test.db"
def set_db_name(name):
global db_name
db_name = name

17
sqlLite/auth.py Normal file
View File

@@ -0,0 +1,17 @@
def login(name_email, password):
import get as getter
password_stored = getter.get_password_by_email(name_email)
if password_stored is None:
return None
elif password_stored != password:
return None
else:
return True
def register(username, email, password):
import standard.getter as st_getter
if st_getter.get_validate_email(email):
hashed_password = st_getter.get_password_hash(password)
import sqlLite.set as sq_setter
sq_setter.set_login(username, email,hashed_password)

View File

@@ -1,17 +1,14 @@
from hashlib import sha512
import sqlite3
import useful.check as check
import useful.hash as hash
import standard.getter as st_getter
from . import db_name
def set_login(username, email, password):
db_con = sqlite3.connect(db_name)
db_cur = db_con.cursor()
try:
if check.check_email(email):
db_cur.execute("INSERT INTO T_USERS (USERNAME, EMAIL, PASSWORD) VALUES (?,?,?)", (username ,email , hash.get_password_hash(password)))
if st_getter.get_validate_email(email):
db_cur.execute("INSERT INTO T_USERS (USERNAME, EMAIL, PASSWORD) VALUES (?,?,?)", (username ,email , st_getter.get_password_hash(password)))
db_con.commit()
else:
print("Email entered is not valid")