Forzar cambio de contraseña después de iniciar sesión

Hola,

Estoy migrando un foro a Discourse. Estoy utilizando el mismo enfoque que el plugin discourse-migratepassword para permitir que los usuarios inicien sesión con su contraseña actual, pero estas contraseñas pueden no ser seguras.

Quiero permitir que los usuarios inicien sesión, pero obligarlos a cambiar su contraseña después del inicio de sesión si no cumple con la configuración de contraseñas de Discourse.

¿Existe alguna forma de hacer esto actualmente? Si no es así, ¿dónde debería buscar para implementarlo como un plugin?

¡Gracias!

1 me gusta

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

3 Me gusta

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)

4 Me gusta

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?

1 me gusta

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).

1 me gusta

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

hey exaktly the same we also need, we will create users via api and a default password… after user loged in first time, he should change his pass…

how did you do that?

Thx!

Instead of creating a user with a default password you should create the user with a random password and never send it to them. Then they can use the forgot password link on the login page to reset their password first before logging in.

3 Me gusta

99% our users have no mail address ^^ and we dont want do add so much mails only for “pass forget mails”

is there no other way instead using real mails?

That will be a big problem as email is considered identity in Discourse…

1 me gusta

If you want to have complete control over the login process in order to comply with your standard, I recommend using Official Single-Sign-On for Discourse (sso).

2 Me gusta

Discourse ahora admite la capacidad nativa de expirar contraseñas.

Para hacerlo, deberás ejecutar:

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

Esto puede ser hecho por el personal de Discourse para clientes alojados o ingresando a tu contenedor, ejecutando una consola de Rails y ejecutando esto en los usuarios particulares.

4 Me gusta

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.