mirror of https://github.com/openspug/spug
U improve websocket security
parent
a5f0ef299f
commit
eb5e3849f8
|
@ -35,6 +35,7 @@ class AuthenticationMiddleware(MiddlewareMixin):
|
|||
user = User.objects.filter(access_token=access_token).first()
|
||||
if user and x_real_ip == user.last_ip and user.token_expired >= time.time() and user.is_active:
|
||||
request.user = user
|
||||
if request.path != '/notify/':
|
||||
user.token_expired = time.time() + 8 * 60 * 60
|
||||
user.save()
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue