mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Blocking dumb client apps without user agents.
This commit is contained in:
parent
19f144df38
commit
b18662872a
1 changed files with 7 additions and 3 deletions
|
@ -23,14 +23,18 @@ from utils.feed_functions import relative_timesince
|
||||||
def login(request):
|
def login(request):
|
||||||
code = -1
|
code = -1
|
||||||
errors = None
|
errors = None
|
||||||
|
user_agent = request.environ.get('HTTP_USER_AGENT', '')
|
||||||
if request.method == "POST":
|
|
||||||
|
if not user_agent:
|
||||||
|
errors = dict(user_agent="You must set a user agent to login.")
|
||||||
|
logging.user(request, "~FG~BB~SK~FRBlocked ~FGAPI Login~SN~FW: %s" % user_agent)
|
||||||
|
elif request.method == "POST":
|
||||||
form = LoginForm(data=request.POST)
|
form = LoginForm(data=request.POST)
|
||||||
if form.errors:
|
if form.errors:
|
||||||
errors = form.errors
|
errors = form.errors
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
login_user(request, form.get_user())
|
login_user(request, form.get_user())
|
||||||
logging.user(request, "~FG~BB~SKAPI Login~FW: %s" % request.environ.get('HTTP_USER_AGENT', ''))
|
logging.user(request, "~FG~BB~SKAPI Login~SN~FW: %s" % user_agent)
|
||||||
code = 1
|
code = 1
|
||||||
else:
|
else:
|
||||||
errors = dict(method="Invalid method. Use POST. You used %s" % request.method)
|
errors = dict(method="Invalid method. Use POST. You used %s" % request.method)
|
||||||
|
|
Loading…
Add table
Reference in a new issue