mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
fixed IP not updating, fixed usernames being case sensitive in update query
This commit is contained in:
parent
635bef867b
commit
6951d7cc8a
@ -176,7 +176,7 @@ class db_builder:
|
||||
api_token = helper.random_string_generator(32)
|
||||
|
||||
Users.insert({
|
||||
Users.username: username,
|
||||
Users.username: username.lower(),
|
||||
Users.password: helper.encode_pass(password),
|
||||
Users.api_token: api_token,
|
||||
Users.enabled: True
|
||||
|
@ -95,10 +95,12 @@ class PublicHandler(BaseHandler):
|
||||
logger.info("User: {} Logged in from IP: {}".format(user_data, self.get_remote_ip()))
|
||||
|
||||
# record this login
|
||||
Users.update({
|
||||
Users.last_ip: self.get_remote_ip(),
|
||||
Users.last_login: helper.get_time_as_string()
|
||||
}).where(Users.username == entered_username).execute()
|
||||
q = Users.select().where(Users.username == entered_username.lower()).get()
|
||||
q.last_ip = self.get_remote_ip()
|
||||
q.last_login = helper.get_time_as_string()
|
||||
q.save()
|
||||
|
||||
print(q)
|
||||
|
||||
# log this login
|
||||
db_helper.add_to_audit_log(user_data.user_id, "Logged in", 0, self.get_remote_ip())
|
||||
|
Loading…
Reference in New Issue
Block a user