إجبار تغيير كلمة المرور بعد تسجيل الدخول

مرحبًا،

أنا أقوم بنقل منتدى إلى Discourse. أستخدم نفس النهج المستخدم في إضافة discourse-migratepassword للسماح للمستخدمين بتسجيل الدخول بكلمات المرور الحالية، لكن قد تكون هذه كلمات مرور غير آمنة.

أرغب في السماح للمستخدمين بتسجيل الدخول، لكن إجبارهم على تغيير كلمة المرور بعد تسجيل الدخول إذا لم تلتزم بإعدادات كلمات المرور في Discourse.

هل هناك طريقة للقيام بذلك حاليًا؟ وإذا لم يكن الأمر كذلك، فإلى أين يجب أن أنظر لتنفيذ ذلك كإضافة؟

شكرًا لك!

Sounds like it would be useful as an option on the discourse-migratepassword plugin. Slightly surprised it isn’t already.

Yeah, we can use that in the plugin too, happy to contribute that back if I implement it.

I was thinking in adding a custom_field to the user and render an alert until the user changes their password, but forcing them to change it sounds like a better option (not sure where to look to achieve this)

Well, I’m not forcing users to change their password, but we are rendering an alert on every login until they do so.

I’m setting a user.custom_fields['migratepassword_policy'] = true if the password doesn’t comply with Discourse settings and using that to conditionally render the modal, and we also send a password reset email once after they log in for the first time (with the insecure password)

What do you guys think?

I think it was enabled without an option in the past - if your password was too short, you were required to do a password reset instead.

The policy was flipped because this was locking people out of their accounts (dead email accounts).

Yeah, in this case we allow users to get into the platform with their current password, but we will render that modal until they change it (they can click OK or click outside the modal and it will close)

Maybe adding a “contact support if you don’t have access to your email anymore” message will do in case of dead email accounts

مرحبًا، نحتاج إلى نفس الشيء تمامًا. سنقوم بإنشاء المستخدمين عبر واجهة برمجة التطبيقات (API) مع تعيين كلمة مرور افتراضية… بعد تسجيل دخول المستخدم لأول مرة، يجب عليه تغيير كلمة مروره…

كيف قمت بذلك؟

شكرًا!

بدلاً من إنشاء مستخدم بكلمة مرور افتراضية، يجب عليك إنشاء المستخدم بكلمة مرور عشوائية وعدم إرسالها إليه أبدًا. بعد ذلك، يمكنه استخدام رابط نسيت كلمة المرور في صفحة تسجيل الدخول لإعادة تعيين كلمة مروره أولاً قبل تسجيل الدخول.

99% من مستخدمينا لا يملكون عنوان بريد إلكتروني ^^ ولا نرغب في إضافة عناوين بريد إلكتروني كثيرة فقط لـ “رسائل نسيان كلمة المرور”

هل لا توجد طريقة أخرى غير استخدام عناوين البريد الإلكتروني الحقيقية؟

سيكون ذلك مشكلة كبيرة، حيث يُعتبر البريد الإلكتروني الهوية في نظام Discourse…

إذا كنت ترغب في الحصول على تحكم كامل في عملية تسجيل الدخول للامتثال لمعاييرك، فإنني أنصح باستخدام تسجيل الدخول الموحد الرسمي لمنصة Discourse (sso).

يدعم Discourse الآن القدرة الأصلية على إنهاء صلاحية كلمات المرور.

للقيام بذلك، ستحتاج إلى تشغيل:

user = User.find_by_username(username)
UserPasswordExpirer.expire_user_password(user)

يمكن القيام بذلك إما بواسطة موظفي Discourse للعملاء المستضافين أو عن طريق الدخول إلى الحاوية الخاصة بك، وتشغيل وحدة تحكم rails وتنفيذ هذا على المستخدمين المعنيين.