Skip to content

Commit f2d7ad9

Browse files
committed
Use new API authentication fields
1 parent a2660b8 commit f2d7ad9

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

4-auth/bookshelf/crud.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ def list_mine():
6262
if token:
6363
token = token.encode('utf-8')
6464

65+
print(session['profile'])
6566
books, next_page_token = get_model().list_by_user(
66-
user_id=session['profile']['id'],
67+
user_id=session['profile']['email'],
6768
cursor=token)
6869

6970
return render_template(
@@ -93,8 +94,8 @@ def add():
9394

9495
# If the user is logged in, associate their profile with the new book.
9596
if 'profile' in session:
96-
data['createdBy'] = session['profile']['displayName']
97-
data['createdById'] = session['profile']['id']
97+
data['createdBy'] = session['profile']['name']
98+
data['createdById'] = session['profile']['email']
9899

99100
book = get_model().create(data)
100101

4-auth/bookshelf/templates/base.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
<p class="navbar-text navbar-right">
3636
{% if session.profile %}
3737
<a href="/logout">
38-
{% if session.profile.image %}
39-
<img class="img-circle" src="{{session.profile.image.url}}" width="24">
38+
{% if session.profile.picture %}
39+
<img class="img-circle" src="{{session.profile.picture}}" width="24">
4040
{% endif %}
41-
{{session.profile.displayName}}
41+
{{session.profile.name}}
4242
</a>
4343
{% else %}
4444
<a href="/oauth2authorize">Login</a>

0 commit comments

Comments
 (0)