Skip to content

Commit

Permalink
Fix link account path for Facebook, GitHub and Bitbucket
Browse files Browse the repository at this point in the history
Fixes current behaviour where a new user is created instead of adding the id to the existing user
  • Loading branch information
stuzl committed Feb 26, 2016
1 parent 8f029d2 commit dda7cfb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/server/python/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def facebook():
response.status_code = 400
return response

u = User(facebook=profile['id'], display_name=profile['name'])
db.session.add(u)
user.facebook = profile['id']
user.display_name = user.display_name or profile['name']
db.session.commit()
token = create_token(u)
return jsonify(token=token)
Expand Down Expand Up @@ -238,8 +238,8 @@ def github():
response.status_code = 400
return response

u = User(github=profile['id'], display_name=profile['name'])
db.session.add(u)
user.github = profile['id']
user.display_name = display_name or profile['name']
db.session.commit()
token = create_token(u)
return jsonify(token=token)
Expand Down Expand Up @@ -439,8 +439,8 @@ def bitbucket():
response.status_code = 400
return response

u = User(bitbucket=profile['uuid'], display_name=profile['display_name'])
db.session.add(u)
user.bitbucket = profile['uuid']
user.display_name = user.display_name or profile['display_name']
db.session.commit()
token = create_token(u)
return jsonify(token=token)
Expand Down

0 comments on commit dda7cfb

Please sign in to comment.