mirror of
https://github.com/simon987/nyaa.git
synced 2025-12-20 01:55:58 +00:00
minor changes
This commit is contained in:
@@ -7,6 +7,7 @@ import flask
|
||||
from flask_paginate import Pagination
|
||||
|
||||
from nyaa import models
|
||||
from nyaa.extensions import db
|
||||
from nyaa.search import (DEFAULT_MAX_SEARCH_RESULT, DEFAULT_PER_PAGE, SERACH_PAGINATE_DISPLAY_MSG,
|
||||
_generate_query_string, search_db, search_elastic)
|
||||
from nyaa.utils import chain_get
|
||||
@@ -40,6 +41,12 @@ def before_request():
|
||||
flask.session.permanent = True
|
||||
flask.session.modified = True
|
||||
|
||||
ip = ip_address(flask.request.remote_addr)
|
||||
if user.last_login_ip != ip:
|
||||
user.last_login_ip = ip.packed
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
|
||||
# Check if user is banned on POST
|
||||
if flask.request.method == 'POST':
|
||||
ip = ip_address(flask.request.remote_addr).packed
|
||||
|
||||
@@ -99,7 +99,8 @@ def edit_torrent(torrent_id):
|
||||
flask.abort(403)
|
||||
|
||||
torrent_user_level = torrent.user and torrent.user.level
|
||||
if editor and editor.is_moderator and (torrent_user_level is None or editor.level > torrent_user_level):
|
||||
if editor and editor.is_moderator and \
|
||||
(torrent_user_level is None or editor.level > torrent_user_level):
|
||||
ban_form = forms.BanForm()
|
||||
|
||||
if flask.request.method == 'POST' and form.submit.data and form.validate():
|
||||
|
||||
Reference in New Issue
Block a user