Change username through API?

(Raphael Haase) #1

I would like to automatically change usernames through the API so they match the email address.
Our community has the policy that the username must be firstname.infix.lastname for a user with the email address
So far I have been changing people’s usernames shortly after registration if they did not match the rule manually through the admin interface and would like to automate that through the API or similar.
I did not find the call in the Discourse API docs - is it hidden somewhere how to rename a user?
Is there an alternate way, i.e. could I somehow enforce that rule already at signup time?

(Jay Pfaffman) #2

If everyone works for the company, the usual solution is to use sso. They way they can’t create the wrong username.

(David Kingham) #3

I would like to dig this back up as I have a similar request. I need a newly registered user’s username to be changed to Firstname_Lastname automatically, but I am already using an SSO (Memberful) and they refuse to do this for ‘security concerns’ :roll_eyes: so I have to do it manually each time a person signs up and inevitably the user emails me about it before I have a chance to change it because it is super boring using only the first name. So is there anyway to to add this as a task? It would of course have to check if the name exists and add a numeral behind it if so. Thanks!