joindin/joindin-api

No way to change username

OGProgrammer opened this issue · 8 comments

I have an old an undesirable username, however I see no way to change it via the web app.

Could I create a migration for my specific username or build the feature to actually change usernames?

I login with twitter but I've since changed my twitter username but didn't pick up here.

Thanks!

It's been awhile, but I think there were some concerns around user-editable usernames.

With that said, since doing so would provide an audit trail, feel free to comment here with the username change migration. Don't think we want it in the codebase per se as in theory you could run joind.in from a blank database elsewhere, but that doesn't stop us from running the statements manually.

Hey.

That change a username has so far been cause for discussions every now and then. So far we solved that usually by editing the database directly in the rare cases where that was requested.

But having that as a "self-service feature" (and if only via the API in the first place) would be interesting. Our discussions usually stopped at the point where we weren't sure what to do with the "old" username. To prevent that name from being taken by someone else and used possibly to the disadvantage of the former "owner" that name should definitely be reserved. And possibly (in the case of a "propper" implementation) also be redirected to the new name. At least if the former owner wishes to do so.

So should I decide to change my username from heiglandreas to heigla any request to /users/heiglandreas should do a redirect to /users/heigla if I requested such a redirect.

So it would require a lookup-possibility for old username to know the new username which also could contain a flag redirect.

And all usernames from the old username would need to be considered when checking for an already registered username.

The main concern was – and still is! – that the feature could be abused to block usernames without creating multiple users by simply changing usernames multiple times. And that was usually the point where the discussion stopped.

Technically it's solvable, but – as usual – the challenge comes with the criminal energy some folks invest in breaking cool things. 😦

See #357

Looks like the updateUser method already allows changing the username. And I'm not sure I'm happy about not reserving the old username...

My old username is PsycodeDotOrg and want it updated to OGProgrammer - Even if it doesn't redirect, it is fine by me. I use twitter to login and that was my old twitter username which has since been updated.

Given @heiglandreas's note, seems like you could grab an API key and make the change with the codebase that's currently deployed, without needing to make upgrades otherwise. Mind trying this and reporting back? If it works, that should at least get you un-stuck.

Oh shoots, I hit a bit of an edge-case here. Went to go get an API token and noticed it requires a password. Since I used SSO via twitter, I don't have a password.

I'll try and get this all setup locally and see if I can add something on the profile edit page. Perhaps I can add something like Andreas mentioned for redirects also.

This issue has been hanging around a bit too long, if needed please update or comment.

@heiglandreas can my old username Nic be changed to nicwortel?

I tried creating an API key and sending a PUT request to https://api.joind.in/v2.1/users/<id>, but I get the following response even though I verified that the new username does not exist:

Request:

PUT https://api.joind.in/v2.1/users/<id>
Authorization: Bearer xxx
Content-Type: application/json
Accept: application/json

{
    "username": "nicwortel",
    "email": "xxx",
    "full_name": "Nic Wortel"
}

Response:

HTTP/1.1 400 Bad Request
Date: Wed, 19 Jul 2023 16:10:02 GMT
Content-Type: application/json; charset=utf8
(...)

[
    "That username is already associated with another account"
]

I wasn't able to verify this but I have a feeling that the logic in UsersController is no longer correct: the UserMapper seems to always return a users key, even if it is empty because there are no results.