Skip to content

Commit

Permalink
Merge pull request #316 from liangliangyy/dev
Browse files Browse the repository at this point in the history
修复用户昵称为空导致报错的bug
  • Loading branch information
liangliangyy committed Aug 29, 2019
2 parents ac539d8 + 96cb9af commit dbc58ed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions oauth/views.py
Expand Up @@ -71,7 +71,7 @@ def authorize(request):
return HttpResponseRedirect(manager.get_authorization_url(nexturl))
user = manager.get_oauth_userinfo()
if user:
if not user.nikename.strip():
if not user.nikename or not user.nikename.strip():
import datetime
user.nikename = "djangoblog" + datetime.datetime.now().strftime('%y%m%d%I%M%S')
try:
Expand All @@ -85,8 +85,7 @@ def authorize(request):
# facebook的token过长
if type == 'facebook':
user.token = ''
email = user.email
if email:
if user.email:
author = None
try:
author = get_user_model().objects.get(id=user.author_id)
Expand Down

0 comments on commit dbc58ed

Please sign in to comment.