Fixing a false table name and uncompleted variable calling on procedure

This commit is contained in:
Dita Aji Pratama 2025-01-20 17:54:23 +07:00
parent 2f4b9fb1a3
commit 37c39437c9
2 changed files with 3 additions and 5 deletions

View File

@ -19,10 +19,8 @@ class validation():
result_profile = self.cursor.fetchone() result_profile = self.cursor.fetchone()
self.cursor.execute("SELECT COUNT(*) AS `count` FROM auth_profile WHERE username = %s ; ", (username,) ) self.cursor.execute("SELECT COUNT(*) AS `count` FROM auth_profile WHERE username = %s ; ", (username,) )
result_username = self.cursor.fetchone() result_username = self.cursor.fetchone()
self.cursor.execute(f"SELECT COUNT(*) AS `count` FROM auth_profile_verification INNER JOIN auth_profile ON auth_profile.id = auth_profile_verification.auth_profile WHERE auth_profile.email = %s AND auth_profile_verification.type = 'email' AND auth_profile_verification.verified = 0 ; ", (email,) ) self.cursor.execute(f"SELECT COUNT(*) AS `count` FROM auth_profile_verification INNER JOIN auth_profile ON auth_profile.id = auth_profile_verification.profile WHERE auth_profile.email = %s AND auth_profile_verification.type = 'email' AND auth_profile_verification.verified = 0 ; ", (email,) )
result_unverified = self.cursor.fetchone() result_unverified = self.cursor.fetchone()
self.cursor.execute(f"SELECT id, name FROM `auth_roles` WHERE auth_roles.name = %s ; ", (roles,) )
result_roles = self.cursor.fetchone()
loggorilla.prcss(APIADDR, "Validating") loggorilla.prcss(APIADDR, "Validating")
if score < 0.2: if score < 0.2:
response["status" ] = "failed" response["status" ] = "failed"
@ -120,7 +118,7 @@ class validation():
} }
else: else:
session_not_found = False session_not_found = False
cursor.execute(f"SELECT COUNT(*) AS `count`, auth_profile.* FROM auth_profile_verification LEFT JOIN auth_profile ON auth_profile.id = auth_profile_verification.auth_profile WHERE auth_profile.token = %s AND auth_profile_verification.type = 'email' AND auth_profile_verification.verified = 1 ; ", (r_session['token'],) ) cursor.execute(f"SELECT COUNT(*) AS `count`, auth_profile.* FROM auth_profile_verification LEFT JOIN auth_profile ON auth_profile.id = auth_profile_verification.profile WHERE auth_profile.token = %s AND auth_profile_verification.type = 'email' AND auth_profile_verification.verified = 1 ; ", (r_session['token'],) )
r_profile = cursor.fetchone() r_profile = cursor.fetchone()
cursor.execute(f"SELECT auth_roles FROM auth_profile_roles WHERE auth_profile = %s ; ", (r_profile['id'],) ) cursor.execute(f"SELECT auth_roles FROM auth_profile_roles WHERE auth_profile = %s ; ", (r_profile['id'],) )
r_roles = cursor.fetchall() r_roles = cursor.fetchall()

View File

@ -9,7 +9,7 @@ class webmail():
def verification(self, APIADDR, params, data): def verification(self, APIADDR, params, data):
return { return {
"subject" : f"{globalvar.title} email verification", "subject" : f"{globalvar.title} email verification",
"text" : f"Please visit this link to complete the registration: {data['verify']}. You are not registering this? report on this: {data['notme'].", "text" : f"Please visit this link to complete the registration: {data['verify']} . You are not registering this? report on this: {data['notme']} .",
"html" : Template(params["mako"]["email"]['index']).render( "html" : Template(params["mako"]["email"]['index']).render(
title = globalvar.title, title = globalvar.title,
header = globalvar.title, header = globalvar.title,