-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatically create hedgedoc user accounts so that edits are no longer anonymous #2
Conversation
…ount based on the user's ctfpad username
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome idea to better integrate hedgedoc, let's use the info already collected by ctfpad via the User
model to make it a bit more secure (because the hedgedoc has to be exposed by ctfpad)
cache: 'no-cache', | ||
credentials: 'include', | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded'}, | ||
body: "email={{request.user}}%40localhost.localdomain&password=hedgedoc"}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use request.user.email
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if I register lanjelot
on ctfpad using hahanfiwhothisis@gmail.com
and we use request.user.email
instead of request.user
then hedgedoc will use hahanfiwhothisis
as the username and we'll have no idea that it is actually me (hedgedoc uses everything before @ as the username)
cache: 'no-cache', | ||
credentials: 'include', | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded'}, | ||
body: "email={{request.user}}%40localhost.localdomain&password=hedgedoc"}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not a fan of static password: we have access to request.user
object, that leaves room for crafting unique password per users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i just wanted to have a quick PoC working, feel free to use request.user.password
or whatever instead. Also I didn't want to bother with what if the user resets or updates their password in ctfpad, then we need to update it in hedgedoc as well etc.
@@ -70,6 +71,17 @@ def form_valid(self, form): | |||
messages.error(self.request, "Username already exists, try logging in instead") | |||
return redirect("ctfpad:home") | |||
|
|||
# create the hedgedoc user | |||
email = form.cleaned_data["username"] + '@localhost.localdomain' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remarks as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same reply as above ;)
This allows "authorship highlightiing", we can now see who made what changes to a note.