Skip to content

Commit 81a13b1

Browse files
authored
Re-auth'ing with Google Oauth shouldn't rm roles (#52)
* Re-auth'ing with Google Oauth shouldn't rm roles * bump version
1 parent 0c3db60 commit 81a13b1

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.9
1+
0.8.10

src/boardwalkd/server.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,16 +310,19 @@ async def get(self, *args: Any, **kwargs: Any):
310310
return self.send_error(400)
311311

312312
# If we get this far we know we have a valid google user
313-
try:
314-
state.users[user["email"]] = User(email=user["email"])
315-
except ValidationError as e:
316-
app_log.error(e)
317-
return self.send_error(422)
318-
state.flush()
313+
username = user["email"]
314+
315+
if username not in state.users:
316+
try:
317+
state.users[username] = User(email=username)
318+
except ValidationError as e:
319+
app_log.error(e)
320+
return self.send_error(422)
321+
state.flush()
319322

320323
self.set_secure_cookie(
321324
"boardwalk_user",
322-
user["email"],
325+
username,
323326
expires_days=self.settings["auth_expire_days"],
324327
samesite="Strict",
325328
secure=True,

0 commit comments

Comments
 (0)