Renaming ipadress - ip_address
Bugfix user table Result testrun Updated cn translation
This commit is contained in:
parent
4e3a5ca33b
commit
144c2b5fc7
24
cps/cli.py
24
cps/cli.py
|
@ -71,7 +71,7 @@ if args.c:
|
||||||
if os.path.isfile(args.c):
|
if os.path.isfile(args.c):
|
||||||
certfilepath = args.c
|
certfilepath = args.c
|
||||||
else:
|
else:
|
||||||
print("Certfilepath is invalid. Exiting...")
|
print("Certfile path is invalid. Exiting...")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.c == "":
|
if args.c == "":
|
||||||
|
@ -81,7 +81,7 @@ if args.k:
|
||||||
if os.path.isfile(args.k):
|
if os.path.isfile(args.k):
|
||||||
keyfilepath = args.k
|
keyfilepath = args.k
|
||||||
else:
|
else:
|
||||||
print("Keyfilepath is invalid. Exiting...")
|
print("Keyfile path is invalid. Exiting...")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if (args.k and not args.c) or (not args.k and args.c):
|
if (args.k and not args.c) or (not args.k and args.c):
|
||||||
|
@ -91,29 +91,29 @@ if (args.k and not args.c) or (not args.k and args.c):
|
||||||
if args.k == "":
|
if args.k == "":
|
||||||
keyfilepath = ""
|
keyfilepath = ""
|
||||||
|
|
||||||
# handle and check ipadress argument
|
# handle and check ip address argument
|
||||||
ipadress = args.i or None
|
ip_address = args.i or None
|
||||||
if ipadress:
|
if ip_address:
|
||||||
try:
|
try:
|
||||||
# try to parse the given ip address with socket
|
# try to parse the given ip address with socket
|
||||||
if hasattr(socket, 'inet_pton'):
|
if hasattr(socket, 'inet_pton'):
|
||||||
if ':' in ipadress:
|
if ':' in ip_address:
|
||||||
socket.inet_pton(socket.AF_INET6, ipadress)
|
socket.inet_pton(socket.AF_INET6, ip_address)
|
||||||
else:
|
else:
|
||||||
socket.inet_pton(socket.AF_INET, ipadress)
|
socket.inet_pton(socket.AF_INET, ip_address)
|
||||||
else:
|
else:
|
||||||
# on windows python < 3.4, inet_pton is not available
|
# on windows python < 3.4, inet_pton is not available
|
||||||
# inet_atom only handles IPv4 addresses
|
# inet_atom only handles IPv4 addresses
|
||||||
socket.inet_aton(ipadress)
|
socket.inet_aton(ip_address)
|
||||||
except socket.error as err:
|
except socket.error as err:
|
||||||
print(ipadress, ':', err)
|
print(ip_address, ':', err)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# handle and check user password argument
|
# handle and check user password argument
|
||||||
user_credentials = args.s or None
|
user_credentials = args.s or None
|
||||||
if user_credentials and ":" not in user_credentials:
|
if user_credentials and ":" not in user_credentials:
|
||||||
print("No valid username:password format")
|
print("No valid 'username:password' format")
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
# Handles enableing of filepicker
|
# Handles enabling of filepicker
|
||||||
filepicker = args.f or None
|
filepicker = args.f or None
|
||||||
|
|
|
@ -192,7 +192,7 @@ class _ConfigSQL(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_config_ipaddress():
|
def get_config_ipaddress():
|
||||||
return cli.ipadress or ""
|
return cli.ip_address or ""
|
||||||
|
|
||||||
def _has_role(self, role_flag):
|
def _has_role(self, role_flag):
|
||||||
return constants.has_flag(self.config_default_role, role_flag)
|
return constants.has_flag(self.config_default_role, role_flag)
|
||||||
|
|
|
@ -257,7 +257,12 @@ def getEbooksFolderId(drive=None):
|
||||||
log.error('Error gDrive, root ID not found')
|
log.error('Error gDrive, root ID not found')
|
||||||
gDriveId.path = '/'
|
gDriveId.path = '/'
|
||||||
session.merge(gDriveId)
|
session.merge(gDriveId)
|
||||||
session.commit()
|
try:
|
||||||
|
session.commit()
|
||||||
|
except OperationalError as ex:
|
||||||
|
log.error("gdrive.db DB is not Writeable")
|
||||||
|
log.debug('Database error: %s', ex)
|
||||||
|
session.rollback()
|
||||||
return gDriveId.gdrive_id
|
return gDriveId.gdrive_id
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,37 +277,42 @@ def getFile(pathId, fileName, drive):
|
||||||
|
|
||||||
def getFolderId(path, drive):
|
def getFolderId(path, drive):
|
||||||
# drive = getDrive(drive)
|
# drive = getDrive(drive)
|
||||||
currentFolderId = getEbooksFolderId(drive)
|
try:
|
||||||
sqlCheckPath = path if path[-1] == '/' else path + '/'
|
currentFolderId = getEbooksFolderId(drive)
|
||||||
storedPathName = session.query(GdriveId).filter(GdriveId.path == sqlCheckPath).first()
|
sqlCheckPath = path if path[-1] == '/' else path + '/'
|
||||||
|
storedPathName = session.query(GdriveId).filter(GdriveId.path == sqlCheckPath).first()
|
||||||
|
|
||||||
if not storedPathName:
|
if not storedPathName:
|
||||||
dbChange = False
|
dbChange = False
|
||||||
s = path.split('/')
|
s = path.split('/')
|
||||||
for i, x in enumerate(s):
|
for i, x in enumerate(s):
|
||||||
if len(x) > 0:
|
if len(x) > 0:
|
||||||
currentPath = "/".join(s[:i+1])
|
currentPath = "/".join(s[:i+1])
|
||||||
if currentPath[-1] != '/':
|
if currentPath[-1] != '/':
|
||||||
currentPath = currentPath + '/'
|
currentPath = currentPath + '/'
|
||||||
storedPathName = session.query(GdriveId).filter(GdriveId.path == currentPath).first()
|
storedPathName = session.query(GdriveId).filter(GdriveId.path == currentPath).first()
|
||||||
if storedPathName:
|
if storedPathName:
|
||||||
currentFolderId = storedPathName.gdrive_id
|
currentFolderId = storedPathName.gdrive_id
|
||||||
else:
|
|
||||||
currentFolder = getFolderInFolder(currentFolderId, x, drive)
|
|
||||||
if currentFolder:
|
|
||||||
gDriveId = GdriveId()
|
|
||||||
gDriveId.gdrive_id = currentFolder['id']
|
|
||||||
gDriveId.path = currentPath
|
|
||||||
session.merge(gDriveId)
|
|
||||||
dbChange = True
|
|
||||||
currentFolderId = currentFolder['id']
|
|
||||||
else:
|
else:
|
||||||
currentFolderId = None
|
currentFolder = getFolderInFolder(currentFolderId, x, drive)
|
||||||
break
|
if currentFolder:
|
||||||
if dbChange:
|
gDriveId = GdriveId()
|
||||||
session.commit()
|
gDriveId.gdrive_id = currentFolder['id']
|
||||||
else:
|
gDriveId.path = currentPath
|
||||||
currentFolderId = storedPathName.gdrive_id
|
session.merge(gDriveId)
|
||||||
|
dbChange = True
|
||||||
|
currentFolderId = currentFolder['id']
|
||||||
|
else:
|
||||||
|
currentFolderId = None
|
||||||
|
break
|
||||||
|
if dbChange:
|
||||||
|
session.commit()
|
||||||
|
else:
|
||||||
|
currentFolderId = storedPathName.gdrive_id
|
||||||
|
except OperationalError as ex:
|
||||||
|
log.error("gdrive.db DB is not Writeable")
|
||||||
|
log.debug('Database error: %s', ex)
|
||||||
|
session.rollback()
|
||||||
return currentFolderId
|
return currentFolderId
|
||||||
|
|
||||||
|
|
||||||
|
@ -346,7 +356,7 @@ def moveGdriveFolderRemote(origin_file, target_folder):
|
||||||
addParents=gFileTargetDir['id'],
|
addParents=gFileTargetDir['id'],
|
||||||
removeParents=previous_parents,
|
removeParents=previous_parents,
|
||||||
fields='id, parents').execute()
|
fields='id, parents').execute()
|
||||||
# if previous_parents has no childs anymore, delete original fileparent
|
# if previous_parents has no children anymore, delete original fileparent
|
||||||
if len(children['items']) == 1:
|
if len(children['items']) == 1:
|
||||||
deleteDatabaseEntry(previous_parents)
|
deleteDatabaseEntry(previous_parents)
|
||||||
drive.auth.service.files().delete(fileId=previous_parents).execute()
|
drive.auth.service.files().delete(fileId=previous_parents).execute()
|
||||||
|
@ -507,9 +517,10 @@ def deleteDatabaseOnChange():
|
||||||
try:
|
try:
|
||||||
session.query(GdriveId).delete()
|
session.query(GdriveId).delete()
|
||||||
session.commit()
|
session.commit()
|
||||||
except (OperationalError, InvalidRequestError):
|
except (OperationalError, InvalidRequestError) as ex:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
log.info(u"GDrive DB is not Writeable")
|
log.debug('Database error: %s', ex)
|
||||||
|
log.error(u"GDrive DB is not Writeable")
|
||||||
|
|
||||||
|
|
||||||
def updateGdriveCalibreFromLocal():
|
def updateGdriveCalibreFromLocal():
|
||||||
|
@ -524,13 +535,23 @@ def updateDatabaseOnEdit(ID,newPath):
|
||||||
storedPathName = session.query(GdriveId).filter(GdriveId.gdrive_id == ID).first()
|
storedPathName = session.query(GdriveId).filter(GdriveId.gdrive_id == ID).first()
|
||||||
if storedPathName:
|
if storedPathName:
|
||||||
storedPathName.path = sqlCheckPath
|
storedPathName.path = sqlCheckPath
|
||||||
session.commit()
|
try:
|
||||||
|
session.commit()
|
||||||
|
except OperationalError as ex:
|
||||||
|
log.error("gdrive.db DB is not Writeable")
|
||||||
|
log.debug('Database error: %s', ex)
|
||||||
|
session.rollback()
|
||||||
|
|
||||||
|
|
||||||
# Deletes the hashes in database of deleted book
|
# Deletes the hashes in database of deleted book
|
||||||
def deleteDatabaseEntry(ID):
|
def deleteDatabaseEntry(ID):
|
||||||
session.query(GdriveId).filter(GdriveId.gdrive_id == ID).delete()
|
session.query(GdriveId).filter(GdriveId.gdrive_id == ID).delete()
|
||||||
session.commit()
|
try:
|
||||||
|
session.commit()
|
||||||
|
except OperationalError as ex:
|
||||||
|
log.error("gdrive.db DB is not Writeable")
|
||||||
|
log.debug('Database error: %s', ex)
|
||||||
|
session.rollback()
|
||||||
|
|
||||||
|
|
||||||
# Gets cover file from gdrive
|
# Gets cover file from gdrive
|
||||||
|
@ -547,7 +568,12 @@ def get_cover_via_gdrive(cover_path):
|
||||||
permissionAdded = PermissionAdded()
|
permissionAdded = PermissionAdded()
|
||||||
permissionAdded.gdrive_id = df['id']
|
permissionAdded.gdrive_id = df['id']
|
||||||
session.add(permissionAdded)
|
session.add(permissionAdded)
|
||||||
session.commit()
|
try:
|
||||||
|
session.commit()
|
||||||
|
except OperationalError as ex:
|
||||||
|
log.error("gdrive.db DB is not Writeable")
|
||||||
|
log.debug('Database error: %s', ex)
|
||||||
|
session.rollback()
|
||||||
return df.metadata.get('webContentLink')
|
return df.metadata.get('webContentLink')
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -546,8 +546,8 @@ def check_auth(username, password):
|
||||||
if bool(user and check_password_hash(str(user.password), password)):
|
if bool(user and check_password_hash(str(user.password), password)):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
ip_Address = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
log.warning('OPDS Login failed for user "%s" IP-address: %s', username.decode('utf-8'), ipAdress)
|
log.warning('OPDS Login failed for user "%s" IP-address: %s', username.decode('utf-8'), ip_Address)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -682,7 +682,7 @@ function move_header_elements() {
|
||||||
handleListServerResponse(data);
|
handleListServerResponse(data);
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
handleListServerResponse({type:"danger", message:data.responseText})
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ function move_header_elements() {
|
||||||
handleListServerResponse(data);
|
handleListServerResponse(data);
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
handleListServerResponse({type:"danger", message:data.responseText})
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ function checkboxChange(checkbox, userId, field, field_index) {
|
||||||
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
||||||
data: {"pk": userId, "field_index": field_index, "value": checkbox.checked},
|
data: {"pk": userId, "field_index": field_index, "value": checkbox.checked},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
handleListServerResponse({type:"danger", message:data.responseText})
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
success: handleListServerResponse
|
success: handleListServerResponse
|
||||||
});
|
});
|
||||||
|
@ -765,7 +765,7 @@ function selectHeader(element, field) {
|
||||||
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
||||||
data: {"pk": result, "value": element.value},
|
data: {"pk": result, "value": element.value},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
handleListServerResponse({type:"danger", message:data.responseText})
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
success: handleListServerResponse,
|
success: handleListServerResponse,
|
||||||
});
|
});
|
||||||
|
@ -783,7 +783,7 @@ function checkboxHeader(CheckboxState, field, field_index) {
|
||||||
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
||||||
data: {"pk": result, "field_index": field_index, "value": CheckboxState},
|
data: {"pk": result, "field_index": field_index, "value": CheckboxState},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
handleListServerResponse({type:"danger", message:data.responseText}, true)
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
handleListServerResponse (data, true)
|
handleListServerResponse (data, true)
|
||||||
|
@ -812,7 +812,7 @@ function deleteUser(a,id){
|
||||||
handleListServerResponse(data);
|
handleListServerResponse(data);
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
handleListServerResponse({type:"danger", message:data.responseText})
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ msgstr "显示全部"
|
||||||
|
|
||||||
#: cps/admin.py:353 cps/admin.py:1275
|
#: cps/admin.py:353 cps/admin.py:1275
|
||||||
msgid "Guest Name can't be changed"
|
msgid "Guest Name can't be changed"
|
||||||
msgstr ""
|
msgstr "访客名称无法更改"
|
||||||
|
|
||||||
#: cps/admin.py:362
|
#: cps/admin.py:362
|
||||||
msgid "Guest can't have this role"
|
msgid "Guest can't have this role"
|
||||||
|
@ -1488,32 +1488,32 @@ msgstr "在书库"
|
||||||
#: cps/templates/author.html:26 cps/templates/index.html:68
|
#: cps/templates/author.html:26 cps/templates/index.html:68
|
||||||
#: cps/templates/search.html:29 cps/templates/shelf.html:16
|
#: cps/templates/search.html:29 cps/templates/shelf.html:16
|
||||||
msgid "Sort according to book date, newest first"
|
msgid "Sort according to book date, newest first"
|
||||||
msgstr ""
|
msgstr "按图书日期排序,最新优先"
|
||||||
|
|
||||||
#: cps/templates/author.html:27 cps/templates/index.html:69
|
#: cps/templates/author.html:27 cps/templates/index.html:69
|
||||||
#: cps/templates/search.html:30 cps/templates/shelf.html:17
|
#: cps/templates/search.html:30 cps/templates/shelf.html:17
|
||||||
msgid "Sort according to book date, oldest first"
|
msgid "Sort according to book date, oldest first"
|
||||||
msgstr ""
|
msgstr "按图书日期排序,最旧优先"
|
||||||
|
|
||||||
#: cps/templates/author.html:28 cps/templates/index.html:70
|
#: cps/templates/author.html:28 cps/templates/index.html:70
|
||||||
#: cps/templates/search.html:31 cps/templates/shelf.html:18
|
#: cps/templates/search.html:31 cps/templates/shelf.html:18
|
||||||
msgid "Sort title in alphabetical order"
|
msgid "Sort title in alphabetical order"
|
||||||
msgstr ""
|
msgstr "按标题按字母顺序排序"
|
||||||
|
|
||||||
#: cps/templates/author.html:29 cps/templates/index.html:71
|
#: cps/templates/author.html:29 cps/templates/index.html:71
|
||||||
#: cps/templates/search.html:32 cps/templates/shelf.html:19
|
#: cps/templates/search.html:32 cps/templates/shelf.html:19
|
||||||
msgid "Sort title in reverse alphabetical order"
|
msgid "Sort title in reverse alphabetical order"
|
||||||
msgstr ""
|
msgstr "按标题逆字母顺序排序"
|
||||||
|
|
||||||
#: cps/templates/author.html:30 cps/templates/index.html:74
|
#: cps/templates/author.html:30 cps/templates/index.html:74
|
||||||
#: cps/templates/search.html:35 cps/templates/shelf.html:22
|
#: cps/templates/search.html:35 cps/templates/shelf.html:22
|
||||||
msgid "Sort according to publishing date, newest first"
|
msgid "Sort according to publishing date, newest first"
|
||||||
msgstr ""
|
msgstr "按出版日期排序,最新优先"
|
||||||
|
|
||||||
#: cps/templates/author.html:31 cps/templates/index.html:75
|
#: cps/templates/author.html:31 cps/templates/index.html:75
|
||||||
#: cps/templates/search.html:36 cps/templates/shelf.html:23
|
#: cps/templates/search.html:36 cps/templates/shelf.html:23
|
||||||
msgid "Sort according to publishing date, oldest first"
|
msgid "Sort according to publishing date, oldest first"
|
||||||
msgstr ""
|
msgstr "按出版日期排序,最旧优先"
|
||||||
|
|
||||||
#: cps/templates/author.html:57 cps/templates/author.html:117
|
#: cps/templates/author.html:57 cps/templates/author.html:117
|
||||||
#: cps/templates/discover.html:30 cps/templates/index.html:29
|
#: cps/templates/discover.html:30 cps/templates/index.html:29
|
||||||
|
@ -2044,7 +2044,7 @@ msgstr ""
|
||||||
|
|
||||||
#: cps/templates/config_edit.html:344
|
#: cps/templates/config_edit.html:344
|
||||||
msgid "Autodetect"
|
msgid "Autodetect"
|
||||||
msgstr ""
|
msgstr "自动检测"
|
||||||
|
|
||||||
#: cps/templates/config_edit.html:345
|
#: cps/templates/config_edit.html:345
|
||||||
msgid "Custom Filter"
|
msgid "Custom Filter"
|
||||||
|
|
|
@ -713,9 +713,12 @@ def init_db(app_db_path):
|
||||||
create_anonymous_user(session)
|
create_anonymous_user(session)
|
||||||
|
|
||||||
if cli.user_credentials:
|
if cli.user_credentials:
|
||||||
username, password = cli.user_credentials.split(':')
|
username, password = cli.user_credentials.split(':', 1)
|
||||||
user = session.query(User).filter(func.lower(User.name) == username.lower()).first()
|
user = session.query(User).filter(func.lower(User.name) == username.lower()).first()
|
||||||
if user:
|
if user:
|
||||||
|
if not password:
|
||||||
|
print("Empty password is not allowed")
|
||||||
|
sys.exit(4)
|
||||||
user.password = generate_password_hash(password)
|
user.password = generate_password_hash(password)
|
||||||
if session_commit() == "":
|
if session_commit() == "":
|
||||||
print("Password for user '{}' changed".format(username))
|
print("Password for user '{}' changed".format(username))
|
||||||
|
|
12
cps/web.py
12
cps/web.py
|
@ -1487,23 +1487,23 @@ def login():
|
||||||
log.info(error)
|
log.info(error)
|
||||||
flash(_(u"Could not login: %(message)s", message=error), category="error")
|
flash(_(u"Could not login: %(message)s", message=error), category="error")
|
||||||
else:
|
else:
|
||||||
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
ip_Address = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
log.warning('LDAP Login failed for user "%s" IP-address: %s', form['username'], ipAdress)
|
log.warning('LDAP Login failed for user "%s" IP-address: %s', form['username'], ip_Address)
|
||||||
flash(_(u"Wrong Username or Password"), category="error")
|
flash(_(u"Wrong Username or Password"), category="error")
|
||||||
else:
|
else:
|
||||||
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
ip_Address = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
if 'forgot' in form and form['forgot'] == 'forgot':
|
if 'forgot' in form and form['forgot'] == 'forgot':
|
||||||
if user != None and user.name != "Guest":
|
if user != None and user.name != "Guest":
|
||||||
ret, __ = reset_password(user.id)
|
ret, __ = reset_password(user.id)
|
||||||
if ret == 1:
|
if ret == 1:
|
||||||
flash(_(u"New Password was send to your email address"), category="info")
|
flash(_(u"New Password was send to your email address"), category="info")
|
||||||
log.info('Password reset for user "%s" IP-address: %s', form['username'], ipAdress)
|
log.info('Password reset for user "%s" IP-address: %s', form['username'], ip_Address)
|
||||||
else:
|
else:
|
||||||
log.error(u"An unknown error occurred. Please try again later")
|
log.error(u"An unknown error occurred. Please try again later")
|
||||||
flash(_(u"An unknown error occurred. Please try again later."), category="error")
|
flash(_(u"An unknown error occurred. Please try again later."), category="error")
|
||||||
else:
|
else:
|
||||||
flash(_(u"Please enter valid username to reset password"), category="error")
|
flash(_(u"Please enter valid username to reset password"), category="error")
|
||||||
log.warning('Username missing for password reset IP-address: %s', ipAdress)
|
log.warning('Username missing for password reset IP-address: %s', ip_Address)
|
||||||
else:
|
else:
|
||||||
if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest":
|
if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest":
|
||||||
login_user(user, remember=bool(form.get('remember_me')))
|
login_user(user, remember=bool(form.get('remember_me')))
|
||||||
|
@ -1512,7 +1512,7 @@ def login():
|
||||||
config.config_is_initial = False
|
config.config_is_initial = False
|
||||||
return redirect_back(url_for("web.index"))
|
return redirect_back(url_for("web.index"))
|
||||||
else:
|
else:
|
||||||
log.warning('Login failed for user "%s" IP-address: %s', form['username'], ipAdress)
|
log.warning('Login failed for user "%s" IP-address: %s', form['username'], ip_Address)
|
||||||
flash(_(u"Wrong Username or Password"), category="error")
|
flash(_(u"Wrong Username or Password"), category="error")
|
||||||
|
|
||||||
next_url = request.args.get('next', default=url_for("web.index"), type=str)
|
next_url = request.args.get('next', default=url_for("web.index"), type=str)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user