أود تغيير أسماء المستخدمين تلقائيًا عبر واجهة برمجة التطبيقات (API) لتتطابق مع عناوين البريد الإلكتروني.
تتبع مجتمعه سياسة تقضي بأن يكون اسم المستخدم على شكل الاسم الأول.الوسيط.الاسم الأخير لمستخدم لديه عنوان بريد إلكتروني بصيغة الاسم الأول.الوسيط.الاسم الأخير@الشركة.com.
حتى الآن، كنت أقوم بتغيير أسماء الأشخاص بعد تسجيلهم بوقت قصير إذا لم تكن مطابقة للقاعدة، وذلك يدويًا عبر واجهة المسؤول، وأود أتمتة ذلك عبر واجهة برمجة التطبيقات أو ما شابه.
لم أجد الاستدعاء في وثائق واجهة برمجة تطبيقات Discourse - هل هناك طريقة مخفية لإعادة تسمية مستخدم ما؟
هل توجد طريقة بديلة، أي هل يمكنني فرض هذه القاعدة بالفعل عند لحظة التسجيل؟
If everyone works for the company, the usual solution is to use sso. They way they can’t create the wrong username.
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’
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!
من How does one change a username via the API? - #2 by blake :
جرب نقطة النهاية هذه بدلاً من ذلك:
curl -i -sS -X PUT "http://127.0.0.1:3000/u/blake/preferences/username.json" \ -H "Content-Type: multipart/form-data;" \ -F "api_key=a66d01fbe98cc51b2747d8bfe99f81d7adca18317fbf3c43aa20f340d8e25bfe" \ -F "api_username=system" \ -F "new_username=blake2"وسيخرج:
{"id":1,"username":"blake2"}