mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-14 23:10:15 +02:00
Correct logging string formatting.
This commit is contained in:
parent
fd876b8636
commit
ad79b4f77c
@ -51,31 +51,31 @@ class MarketManager:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_username(cls, username):
|
def check_username(cls, username):
|
||||||
logger.debug("Checking alliance market username %%s" % username)
|
logger.debug("Checking alliance market username %s" % username)
|
||||||
cursor = connections['market'].cursor()
|
cursor = connections['market'].cursor()
|
||||||
cursor.execute(cls.SQL_CHECK_USERNAME, [cls.__santatize_username(username)])
|
cursor.execute(cls.SQL_CHECK_USERNAME, [cls.__santatize_username(username)])
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
if row:
|
if row:
|
||||||
logger.debug("Found user %%s on alliance market" % username)
|
logger.debug("Found user %s on alliance market" % username)
|
||||||
return True
|
return True
|
||||||
logger.debug("User %%s not found on alliance market" % username)
|
logger.debug("User %s not found on alliance market" % username)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_user_email(cls, username, email):
|
def check_user_email(cls, username, email):
|
||||||
logger.debug("Checking if alliance market email exists for user %%s" % username)
|
logger.debug("Checking if alliance market email exists for user %s" % username)
|
||||||
cursor = connections['market'].cursor()
|
cursor = connections['market'].cursor()
|
||||||
cursor.execute(cls.SQL_CHECK_EMAIL, [email])
|
cursor.execute(cls.SQL_CHECK_EMAIL, [email])
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
if row:
|
if row:
|
||||||
logger.debug("Found user %%s email address on alliance market" % username)
|
logger.debug("Found user %s email address on alliance market" % username)
|
||||||
return True
|
return True
|
||||||
logger.debug("User %%s email address not found on alliance market" % username)
|
logger.debug("User %s email address not found on alliance market" % username)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_user(cls, username, email, characterid, charactername):
|
def add_user(cls, username, email, characterid, charactername):
|
||||||
logger.debug("Adding new market user %%s" % username)
|
logger.debug("Adding new market user %s" % username)
|
||||||
plain_password = cls.__generate_random_pass()
|
plain_password = cls.__generate_random_pass()
|
||||||
hash = cls._gen_pwhash(plain_password)
|
hash = cls._gen_pwhash(plain_password)
|
||||||
salt = cls._get_salt(hash)
|
salt = cls._get_salt(hash)
|
||||||
@ -83,33 +83,33 @@ class MarketManager:
|
|||||||
if not cls.check_username(username):
|
if not cls.check_username(username):
|
||||||
if not cls.check_user_email(username, email):
|
if not cls.check_user_email(username, email):
|
||||||
try:
|
try:
|
||||||
logger.debug("Adding user %%s to alliance market" % username)
|
logger.debug("Adding user %s to alliance market" % username)
|
||||||
cursor = connections['market'].cursor()
|
cursor = connections['market'].cursor()
|
||||||
cursor.execute(cls.SQL_ADD_USER, [username_clean, username_clean, email, email, salt,
|
cursor.execute(cls.SQL_ADD_USER, [username_clean, username_clean, email, email, salt,
|
||||||
hash, characterid, charactername])
|
hash, characterid, charactername])
|
||||||
return username_clean, plain_password
|
return username_clean, plain_password
|
||||||
except:
|
except:
|
||||||
logger.debug("Unsuccessful attempt to add market user %%s" % username)
|
logger.debug("Unsuccessful attempt to add market user %s" % username)
|
||||||
return "", ""
|
return "", ""
|
||||||
else:
|
else:
|
||||||
logger.debug("Alliance market email %%s already exists Updating instead" % email)
|
logger.debug("Alliance market email %s already exists Updating instead" % email)
|
||||||
username_clean, password = cls.update_user_info(username)
|
username_clean, password = cls.update_user_info(username)
|
||||||
return username_clean, password
|
return username_clean, password
|
||||||
else:
|
else:
|
||||||
logger.debug("Alliance market username %%s already exists Updating instead" % username)
|
logger.debug("Alliance market username %s already exists Updating instead" % username)
|
||||||
username_clean, password = cls.update_user_info(username)
|
username_clean, password = cls.update_user_info(username)
|
||||||
return username_clean, password
|
return username_clean, password
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def disable_user(cls, username):
|
def disable_user(cls, username):
|
||||||
logger.debug("Disabling alliance market user %%s " % username)
|
logger.debug("Disabling alliance market user %s " % username)
|
||||||
cursor = connections['market'].cursor()
|
cursor = connections['market'].cursor()
|
||||||
cursor.execute(cls.SQL_DISABLE_USER, [username])
|
cursor.execute(cls.SQL_DISABLE_USER, [username])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_custom_password(cls, username, plain_password):
|
def update_custom_password(cls, username, plain_password):
|
||||||
logger.debug("Updating alliance market user %%s password" % username)
|
logger.debug("Updating alliance market user %s password" % username)
|
||||||
if cls.check_username(username):
|
if cls.check_username(username):
|
||||||
username_clean = cls.__santatize_username(username)
|
username_clean = cls.__santatize_username(username)
|
||||||
hash = cls._gen_pwhash(plain_password)
|
hash = cls._gen_pwhash(plain_password)
|
||||||
@ -118,12 +118,12 @@ class MarketManager:
|
|||||||
cursor.execute(cls.SQL_UPDATE_PASSWORD, [hash, salt, username_clean])
|
cursor.execute(cls.SQL_UPDATE_PASSWORD, [hash, salt, username_clean])
|
||||||
return plain_password
|
return plain_password
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to update alliance market user %%s password" % username)
|
logger.error("Unable to update alliance market user %s password" % username)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_user_password(cls, username):
|
def update_user_password(cls, username):
|
||||||
logger.debug("Updating alliance market user %%s password" % username)
|
logger.debug("Updating alliance market user %s password" % username)
|
||||||
if cls.check_username(username):
|
if cls.check_username(username):
|
||||||
username_clean = cls.__santatize_username(username)
|
username_clean = cls.__santatize_username(username)
|
||||||
plain_password = cls.__generate_random_pass()
|
plain_password = cls.__generate_random_pass()
|
||||||
@ -133,12 +133,12 @@ class MarketManager:
|
|||||||
cursor.execute(cls.SQL_UPDATE_PASSWORD, [hash, salt, username_clean])
|
cursor.execute(cls.SQL_UPDATE_PASSWORD, [hash, salt, username_clean])
|
||||||
return plain_password
|
return plain_password
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to update alliance market user %%s password" % username)
|
logger.error("Unable to update alliance market user %s password" % username)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_user_info(cls, username):
|
def update_user_info(cls, username):
|
||||||
logger.debug("Updating alliance market user %%s" % username)
|
logger.debug("Updating alliance market user %s" % username)
|
||||||
try:
|
try:
|
||||||
username_clean = cls.__santatize_username(username)
|
username_clean = cls.__santatize_username(username)
|
||||||
plain_password = cls.__generate_random_pass()
|
plain_password = cls.__generate_random_pass()
|
||||||
@ -148,5 +148,5 @@ class MarketManager:
|
|||||||
cursor.execute(cls.SQL_UPDATE_USER, [hash, salt, username_clean])
|
cursor.execute(cls.SQL_UPDATE_USER, [hash, salt, username_clean])
|
||||||
return username_clean, plain_password
|
return username_clean, plain_password
|
||||||
except:
|
except:
|
||||||
logger.debug("Alliance market update user failed for %%s" % username)
|
logger.debug("Alliance market update user failed for %s" % username)
|
||||||
return "", ""
|
return "", ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user