Force password change after login

Hello,

I’m migrating a forum to Discourse. I’m using the same approach as the discourse-migratepassword plugin to allow users to log in with their current password, but these passwords may be insecure.

I want to allow the users to log in but force them to change their password after login if doesn’t comply with Discourse’s password settings.

Is there a way to currently do this? If not, where I should look at to implement this as a plugin?

Thanks!

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에서 신원(identity)으로 간주되므로, 이는 큰 문제가 될 것입니다…

로그인 프로세스에 대한 완전한 제어 권한을 확보하여 표준을 준수하려면 Discourse 공식 단일 로그인(SSO) 사용을 권장합니다.

Discourse는 이제 비밀번호를 만료시키는 네이티브 기능을 지원합니다.

이를 실행하려면 다음을 실행해야 합니다:

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

이 작업은 호스팅 고객의 경우 Discourse 스태프가 수행하거나, 컨테이너에 진입하여 rails 콘솔을 실행한 후 해당 사용자에게 이 명령을 실행함으로써 수행할 수 있습니다.