Fix access token being exposed after APIToken edit

This commit is contained in:
rubenwardy 2020-01-25 18:26:55 +00:00
parent 53a5dffb26
commit 36615ef656
1 changed files with 3 additions and 4 deletions

View File

@ -80,14 +80,13 @@ def create_edit_token(username, id=None):
token.owner = user
token.access_token = randomString(32)
# Store token so it can be shown in the edit page
session["token_" + str(token.id)] = token.access_token
form.populate_obj(token)
db.session.add(token)
db.session.commit() # save
# Store token so it can be shown in the edit page
session["token_" + str(token.id)] = token.access_token
return redirect(url_for("api.create_edit_token", username=username, id=token.id))
return render_template("api/create_edit_token.html", user=user, form=form, token=token, access_token=access_token)