mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-25 05:42:24 +00:00
Store access token id in session data
This commit is contained in:
parent
d3c2441111
commit
41435a6838
@ -202,6 +202,10 @@ class AccessToken(models.Model):
|
||||
|
||||
return user
|
||||
|
||||
@classmethod
|
||||
def get_token(cls, request):
|
||||
return AccessToken.objects.get(pk=request.session['access_token_id'])
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('access token')
|
||||
verbose_name_plural = _('access tokens')
|
||||
|
@ -37,6 +37,8 @@ class AuthorizeView(RedirectView):
|
||||
datetime.fromtimestamp(token['expires_at'])),
|
||||
)
|
||||
user = token_obj.fetch_user(True)
|
||||
self.request.session['access_token_id'] = token_obj.id
|
||||
self.request.session.save()
|
||||
login(self.request, user)
|
||||
return reverse('index')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user