From cdb54a0670315faab500d6273200ee38a60cfd7e Mon Sep 17 00:00:00 2001 From: Naiel <109038805+naielv@users.noreply.github.com> Date: Fri, 13 Feb 2026 12:33:32 +0000 Subject: [PATCH] =?UTF-8?q?Generar=20y=20almacenar=20una=20contrase=C3=B1a?= =?UTF-8?q?=20aleatoria=20para=20el=20usuario=20al=20iniciar=20sesi=C3=B3n?= =?UTF-8?q?=20con=20Google?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public_html/_login.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public_html/_login.php b/public_html/_login.php index c86c0d0..af3e907 100755 --- a/public_html/_login.php +++ b/public_html/_login.php @@ -54,6 +54,7 @@ if ($_GET["google_callback"] == "1") { $email = $user_info["email"]; $name = $user_info["name"] ?? explode("@", $email)[0]; $userfile = "/DATA/Usuarios/" . strtolower(str_replace("@", "__", $email)) . ".json"; + $password = bin2hex(random_bytes(16)); // Generar una contraseña aleatoria para el usuario, aunque no se usará para iniciar sesión if (file_exists($userfile)) { $userdata = json_decode(file_get_contents($userfile), true); } else { @@ -61,7 +62,7 @@ if ($_GET["google_callback"] == "1") { "display_name" => $name, "email" => $email, "permissions" => ["public"], - "password_hash" => password_hash(bin2hex(random_bytes(16)), PASSWORD_DEFAULT), // Contraseña aleatoria, ya que no se usará + "password_hash" => password_hash($password, PASSWORD_DEFAULT), "google_auth" => true, "#" => "Este usuario fue creado automáticamente al iniciar sesión con Google por primera vez.", ];