mirror of
https://github.com/KeymonSoft/jRDC-MultiDB-Hikari.git
synced 2026-04-17 21:06:23 +00:00
- VERSION 5.10.27
- feat(arquitectura): Consolidación de estabilidad y diagnóstico. - refactor: Arquitectura de base de datos local y políticas de logs. - arch(sqlite): Aislamiento total de las conexiones SQLite en SQL_Auth y SQL_Logs. Esto protege las operaciones de autenticación críticas de la alta carga de I/O generada por el subsistema de logs. - feat(logs): Implementación de modo de almacenamiento flexible para logs (disco o en memoria), mejorando la capacidad de testing. - refactor(logs): Se estandariza el límite de retención de registros a 10,000 para todas las tablas de logs, y se renombra la subrutina de limpieza a borraArribaDe10000Logs.
This commit is contained in:
@@ -14,7 +14,7 @@ Public Sub Initialize
|
||||
End Sub
|
||||
|
||||
Public Sub Handle(req As ServletRequest, resp As ServletResponse)
|
||||
Log("--- CHANGEPASSHANDLER FUE LLAMADO ---") ' <--- ¡PON ESTA LÍNEA AQUÍ!
|
||||
Log("--- CHANGEPASSHANDLER FUE LLAMADO ---")
|
||||
If req.GetSession.GetAttribute2("user_is_authorized", False) = False Then
|
||||
resp.SendRedirect("/login")
|
||||
Return
|
||||
@@ -26,27 +26,26 @@ Public Sub Handle(req As ServletRequest, resp As ServletResponse)
|
||||
Dim confirmPass As String = req.GetParameter("confirm_password")
|
||||
|
||||
If newPass <> confirmPass Then
|
||||
resp.Write("<script>alert('Error: La nueva contraseña no coincide con la confirmación.'); history.back();</script>")
|
||||
resp.Write("Las contraseñas no coinciden.")
|
||||
Return
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim storedHash As String = Main.SQL1.ExecQuerySingleResult2("SELECT password_hash FROM users WHERE username = ?", Array As String(currentUser))
|
||||
|
||||
' 1. Verification of the current password hash using SQL_Auth.
|
||||
Dim storedHash As String = Main.SQL_Auth.ExecQuerySingleResult2("SELECT password_hash FROM users WHERE username = ?", Array As String(currentUser))
|
||||
Log("Valor de la BD (storedHash): " & storedHash)
|
||||
If storedHash = Null Or bc.checkpw(currentPass, storedHash) = False Then ' <<--- CAMBIO CLAVE AQUÍ
|
||||
resp.Write("<script>alert('Error: La contraseña actual es incorrecta.'); history.back();</script>")
|
||||
|
||||
If storedHash = Null Or bc.checkpw(currentPass, storedHash) = False Then
|
||||
resp.Write("Contraseña actual incorrecta.")
|
||||
Return
|
||||
End If
|
||||
|
||||
' <<--- CORRECCIÓN 2: Usamos el método seguro y consistente con 'Main'.
|
||||
' 2. Hashing and updating the new password using SQL_Auth.
|
||||
Dim newHashedPass As String = bc.hashpw(newPass, bc.gensalt)
|
||||
Main.SQL1.ExecNonQuery2("UPDATE users SET password_hash = ? WHERE username = ?", Array As Object(newHashedPass, currentUser))
|
||||
|
||||
resp.Write("<script>alert('Contraseña actualizada correctamente.'); window.location.href='/manager';</script>")
|
||||
|
||||
Main.SQL_Auth.ExecNonQuery2("UPDATE users SET password_hash = ? WHERE username = ?", Array As Object(newHashedPass, currentUser))
|
||||
|
||||
resp.Write("Contraseña cambiada exitosamente.")
|
||||
Catch
|
||||
Log(LastException)
|
||||
resp.Write("<script>alert('Error del servidor al intentar cambiar la contraseña.'); history.back();</script>")
|
||||
resp.Write("Error interno al cambiar la contraseña.")
|
||||
End Try
|
||||
End Sub
|
||||
Reference in New Issue
Block a user