Forza il cambio password dopo il login

Ciao,

Sto migrando un forum a Discourse. Sto utilizzando lo stesso approccio del plugin discourse-migratepassword per consentire agli utenti di accedere con la loro password attuale, ma queste password potrebbero non essere sicure.

Vorrei permettere agli utenti di accedere, ma costringerli a cambiare la password dopo il login se non è conforme alle impostazioni di password di Discourse.

È possibile farlo attualmente? In caso contrario, dove dovrei guardare per implementarlo come plugin?

Grazie!

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

Ehi, esattamente la stessa cosa che ci serve: creeremo gli utenti tramite API con una password predefinita… dopo il primo accesso, l’utente dovrà cambiare la password…

Come hai fatto tu?

Grazie!

Invece di creare un utente con una password predefinita, dovresti crearlo con una password casuale e non inviarla mai. In questo modo, potranno utilizzare il link “Password dimenticata” sulla pagina di accesso per reimpostare la password prima di effettuare il login.

Il 99% dei nostri utenti non ha un indirizzo email ^^ e non vogliamo aggiungere così tanti indirizzi email solo per le email di “recupero password”.

Non c’è un altro modo oltre all’uso di indirizzi email reali?

Questo sarà un grosso problema, dato che in Discourse l’email è considerata un’identità…

Se desideri avere il controllo completo sul processo di accesso per conformarti ai tuoi standard, ti consiglio di utilizzare Single Sign-On ufficiale per Discourse (SSO).

Discourse ora supporta la possibilità nativa di scadere le password.

Per farlo, dovrai eseguire:

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

Questo può essere fatto dallo staff di Discourse per i clienti ospitati o entrando nel tuo container, eseguendo una console rails ed eseguendo questo sui singoli utenti.