mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-10-30 23:03:02 +00:00 
			
		
		
		
	Remove trailing spaces from username during login
Upload of books working on windows without errors
This commit is contained in:
		| @@ -192,20 +192,20 @@ def update_dir_stucture(book_id): | |||||||
|     book = db.session.query(db.Books).filter(db.Books.id == book_id).first() |     book = db.session.query(db.Books).filter(db.Books.id == book_id).first() | ||||||
|     path = os.path.join(config.DB_ROOT, book.path) |     path = os.path.join(config.DB_ROOT, book.path) | ||||||
|      |      | ||||||
|     authordir = book.path.split("/")[0] |     authordir = book.path.split(os.sep)[0] | ||||||
|     new_authordir=get_valid_filename(book.authors[0].name, False) |     new_authordir=get_valid_filename(book.authors[0].name, False) | ||||||
|     titledir = book.path.split("/")[1] |     titledir = book.path.split(os.sep)[1] | ||||||
|     new_titledir = get_valid_filename(book.title, False) + " (" + str(book_id) + ")" |     new_titledir = get_valid_filename(book.title, False) + " (" + str(book_id) + ")" | ||||||
|      |      | ||||||
|     if titledir != new_titledir: |     if titledir != new_titledir: | ||||||
|         new_title_path = os.path.join(os.path.dirname(path), new_titledir) |         new_title_path = os.path.join(os.path.dirname(path), new_titledir) | ||||||
|         os.rename(path, new_title_path) |         os.rename(path, new_title_path) | ||||||
|         path = new_title_path |         path = new_title_path | ||||||
|         book.path = book.path.split("/")[0] + "/" + new_titledir |         book.path = book.path.split(os.sep)[0] + os.sep + new_titledir | ||||||
|      |      | ||||||
|     if authordir != new_authordir: |     if authordir != new_authordir: | ||||||
|         new_author_path = os.path.join(os.path.join(config.DB_ROOT, new_authordir), os.path.basename(path)) |         new_author_path = os.path.join(os.path.join(config.DB_ROOT, new_authordir), os.path.basename(path)) | ||||||
|         os.renames(path, new_author_path) |         os.renames(path, new_author_path) | ||||||
|         book.path = new_authordir + "/" + book.path.split("/")[1] |         book.path = new_authordir + os.sep + book.path.split(os.sep)[1] | ||||||
|     db.session.commit() |     db.session.commit() | ||||||
|      |      | ||||||
|   | |||||||
| @@ -983,7 +983,7 @@ def login(): | |||||||
|  |  | ||||||
|     if request.method == "POST": |     if request.method == "POST": | ||||||
|         form = request.form.to_dict() |         form = request.form.to_dict() | ||||||
|         user = ub.session.query(ub.User).filter(ub.User.nickname == form['username']).first() |         user = ub.session.query(ub.User).filter(ub.User.nickname == form['username'].strip()).first() | ||||||
|  |  | ||||||
|         if user and check_password_hash(user.password, form['password']): |         if user and check_password_hash(user.password, form['password']): | ||||||
|             login_user(user, remember = True) |             login_user(user, remember = True) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 OzzieIsaacs
					OzzieIsaacs