-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotfix - Usuarios - Generación automática de contraseña con requisitos de seguridad #417
Conversation
Actions executed at: 2024-11-19 15:30:33. |
modules/Users/User.php
Outdated
|
||
// Get password requirements | ||
$length = 6; | ||
if (isset($res['minpwdlength']) && is_numeric($res['minpwdlength']) && $res['minpwdlength'] < $length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En caso de configurar un número mayor a 6 no entra en el IF
--> Cambiar $res['minpwdlength'] < $length
por $res['minpwdlength'] > $length
o $res['minpwdlength'] != $length
dependiendo de si queremos que la contraseña tenga 6 caracteres de longitud mínima o no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corregido: Asumido que la longitud mínima será 6: en la antigua generación de contraseñas siempre se generaban de longitud 6
modules/Users/User.php
Outdated
$password .= implode('', $requirements); | ||
|
||
// Create other random characters | ||
for ($i = 0; $i < $length - count($requirements) + 1; $i++) { // loop and create password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se crea una contraseña con un carácter más de lo indicado. Cambiar $i < $length ...
por $i <= $length
o no sumar el + 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corregido 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(A)probado
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(A)Probado
PR SA: salesagility#10592 |
Descripción
Si se definía en "Administración - Usuarios - Administración de contraseñas" una configuración de seguridad de contraseñas, y a la vez se habilitaba la generación de contraseñas por el sistema, las contraseñas generadas automáticamte no cumplían los requisitos de seguridad definidos.
Solución propuesta
Se ha modificado la función
User::generatePassword()
para que genere una contraseña teniendo en cuenta el cumplimiento de los requisitos de seguridad definidos en$sugar_config['passwordsetting']
Pruebas
En una instancia con servidor de correo saliente configurado: