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
|
||||
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.execute(cls.SQL_CHECK_USERNAME, [cls.__santatize_username(username)])
|
||||
row = cursor.fetchone()
|
||||
if row:
|
||||
logger.debug("Found user %%s on alliance market" % username)
|
||||
logger.debug("Found user %s on alliance market" % username)
|
||||
return True
|
||||
logger.debug("User %%s not found on alliance market" % username)
|
||||
logger.debug("User %s not found on alliance market" % username)
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
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.execute(cls.SQL_CHECK_EMAIL, [email])
|
||||
row = cursor.fetchone()
|
||||
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
|
||||
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
|
||||
|
||||
@classmethod
|
||||
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()
|
||||
hash = cls._gen_pwhash(plain_password)
|
||||
salt = cls._get_salt(hash)
|
||||
@ -83,33 +83,33 @@ class MarketManager:
|
||||
if not cls.check_username(username):
|
||||
if not cls.check_user_email(username, email):
|
||||
try:
|
||||
logger.debug("Adding user %%s to alliance market" % username)
|
||||
logger.debug("Adding user %s to alliance market" % username)
|
||||
cursor = connections['market'].cursor()
|
||||
cursor.execute(cls.SQL_ADD_USER, [username_clean, username_clean, email, email, salt,
|
||||
hash, characterid, charactername])
|
||||
return username_clean, plain_password
|
||||
except:
|
||||
logger.debug("Unsuccessful attempt to add market user %%s" % username)
|
||||
logger.debug("Unsuccessful attempt to add market user %s" % username)
|
||||
return "", ""
|
||||
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)
|
||||
return username_clean, password
|
||||
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)
|
||||
return username_clean, password
|
||||
|
||||
@classmethod
|
||||
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.execute(cls.SQL_DISABLE_USER, [username])
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
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):
|
||||
username_clean = cls.__santatize_username(username)
|
||||
hash = cls._gen_pwhash(plain_password)
|
||||
@ -118,12 +118,12 @@ class MarketManager:
|
||||
cursor.execute(cls.SQL_UPDATE_PASSWORD, [hash, salt, username_clean])
|
||||
return plain_password
|
||||
else:
|
||||
logger.error("Unable to update alliance market user %%s password" % username)
|
||||
logger.error("Unable to update alliance market user %s password" % username)
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
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):
|
||||
username_clean = cls.__santatize_username(username)
|
||||
plain_password = cls.__generate_random_pass()
|
||||
@ -133,12 +133,12 @@ class MarketManager:
|
||||
cursor.execute(cls.SQL_UPDATE_PASSWORD, [hash, salt, username_clean])
|
||||
return plain_password
|
||||
else:
|
||||
logger.error("Unable to update alliance market user %%s password" % username)
|
||||
logger.error("Unable to update alliance market user %s password" % username)
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
def update_user_info(cls, username):
|
||||
logger.debug("Updating alliance market user %%s" % username)
|
||||
logger.debug("Updating alliance market user %s" % username)
|
||||
try:
|
||||
username_clean = cls.__santatize_username(username)
|
||||
plain_password = cls.__generate_random_pass()
|
||||
@ -148,5 +148,5 @@ class MarketManager:
|
||||
cursor.execute(cls.SQL_UPDATE_USER, [hash, salt, username_clean])
|
||||
return username_clean, plain_password
|
||||
except:
|
||||
logger.debug("Alliance market update user failed for %%s" % username)
|
||||
logger.debug("Alliance market update user failed for %s" % username)
|
||||
return "", ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user