Skip to content

Commit

Permalink
Security Patch
Browse files Browse the repository at this point in the history
Added md5 to the password system for added security
  • Loading branch information
EndermanPC committed Feb 13, 2024
1 parent bb4c486 commit 8eec8b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions account/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os
import time
import random
import hashlib
import streamlit as st
from hashlib import sha256
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
from account.loader import account_database_loader
Expand Down Expand Up @@ -37,7 +37,7 @@ def send_email(subject, from_email, to_email, content):
print("Error sending email:", str(e))

def add_user(email, username, password, confirm):
password = sha256(password.encode('utf-8')).hexdigest()
password = hashlib.md5(hashlib.sha256(password.encode('utf-8')).hexdigest().encode()).hexdigest()
cursor.execute('''INSERT INTO users (email, username, password, confirm) VALUES (?, ?, ?, ?)''', (email, username, password, confirm))
sys_log("Created User Account", "Username: " + username + " Email: " + email)
conn.commit()
Expand Down
4 changes: 2 additions & 2 deletions account/reliability.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from hashlib import sha256
import hashlib

def get_user_reliability(cursor, username, password):
password = sha256(password.encode('utf-8')).hexdigest()
password = hashlib.md5(hashlib.sha256(password.encode('utf-8')).hexdigest().encode()).hexdigest()

cursor.execute('SELECT password FROM users WHERE username = ?', (username,))
row = cursor.fetchone()
Expand Down
Binary file modified database/users-account.db
Binary file not shown.

0 comments on commit 8eec8b4

Please sign in to comment.