VERSION 5.00
Begin VB.Form FCambClave 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Cambio de Clave"
   ClientHeight    =   4545
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6960
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   4545
   ScaleWidth      =   6960
   Begin VB.CommandButton CMD_ACEPTAR 
      Caption         =   "Aceptar"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   1200
      Picture         =   "FCambClave.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   8
      Tag             =   "R ASDASD"
      Top             =   3600
      Width           =   1455
   End
   Begin VB.CommandButton CMD_CANCELAR 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   3960
      Picture         =   "FCambClave.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   3600
      Width           =   1335
   End
   Begin VB.Frame FraCmClave 
      Height          =   3375
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6855
      Begin VB.TextBox txtconfclave 
         Height          =   285
         IMEMode         =   3  'DISABLE
         Left            =   1680
         MaxLength       =   12
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   2760
         Width           =   1575
      End
      Begin VB.TextBox txtnuevclave 
         Height          =   285
         IMEMode         =   3  'DISABLE
         Left            =   1680
         MaxLength       =   12
         PasswordChar    =   "*"
         TabIndex        =   5
         Top             =   2280
         Width           =   1575
      End
      Begin VB.TextBox txtantclave 
         Height          =   285
         IMEMode         =   3  'DISABLE
         Left            =   1680
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   1800
         Width           =   1575
      End
      Begin VB.Label lblbmensaje 
         Appearance      =   0  'Flat
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   1335
         Left            =   120
         TabIndex        =   9
         Top             =   240
         Width           =   6615
      End
      Begin VB.Label Label3 
         Caption         =   "Repetir Password"
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "Nuevo Password"
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   2280
         Width           =   1335
      End
      Begin VB.Label Label1 
         Caption         =   "Password Anterior"
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   1800
         Width           =   1455
      End
   End
End
Attribute VB_Name = "FCambClave"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Mrs As ADODB.Recordset
Dim Mcmd As ADODB.Command

Dim Util As UTIL_SETUP.C_SETUP
Dim DB_UTM As DB_UT_MANTENIMIENTOS.C_PROCESOS
Dim Mstrsql As String

Private Sub CMD_ACEPTAR_Click()

If Trim(txtantclave.Text) = Empty Then
   MsgBox "Ingrese su clave Actual", vbDefaultButton1 + vbExclamation, "Mensaje"
   txtantclave.SetFocus
   Exit Sub
End If

If Trim(txtnuevclave.Text) = Empty Then
   MsgBox "Ingrese su nueva clave", vbDefaultButton1 + vbExclamation, "Mensaje"
   txtnuevclave.SetFocus
   Exit Sub
End If

If Trim(txtconfclave.Text) = Empty Then
   MsgBox "Confirme su nueva clave", vbDefaultButton1 + vbExclamation, "Mensaje"
   txtconfclave.SetFocus
   Exit Sub
End If

' Verificación de Clave Antigua

Set Mrs = Util.Auxiliar3(Mstrsql)
    
If Trim(Encrip(Trim(UCase(txtantclave.Text)))) <> Trim(Mrs!Password) Then
   MsgBox "La clave Actual ingresada no coincide con la clave Vigente", vbDefaultButton1 + vbExclamation, "Mensaje"
   txtantclave.Text = Empty
   txtantclave.SetFocus
   Exit Sub
End If

' Verificar si las dos claves ingresadas son iguales

Dim LstrValidacion As String
    
LstrValidacion = GValidaPassword(GCUSERID, UCase(Trim(txtnuevclave.Text)))

If LstrValidacion <> "T" Then
     Exit Sub
End If

If UCase(Trim(txtnuevclave.Text)) <> UCase(Trim(txtconfclave.Text)) Then
   MsgBox "Su nueva clave no coincide con la confirmación de ésta  ", vbDefaultButton1 + vbExclamation, "Mensaje"
   txtconfclave.SetFocus
   Exit Sub
End If

Dim LUtproce As DB_UT_MANTENIMIENTOS.C_PROCESOS
Dim Lstrsql As String

Lstrsql = "SE_DesBloquearCuenta '" & GCUSERID & "',""" & Trim(Encrip(Trim(UCase(txtconfclave.Text)))) & """"

Set LUtproce = New DB_UT_MANTENIMIENTOS.C_PROCESOS

LUtproce.Auxiliar1 Lstrsql

MsgBox "Cambio de clave realizado con éxito, el módulo se cerrará", vbDefaultButton1 + vbQuestion, "Mensaje"
Set LUtproce = Nothing
End


End Sub

Private Sub CMD_CANCELAR_Click()
  Unload Me
End Sub

Private Sub Form_Load()

Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2 - 1500

Set Util = New UTIL_SETUP.C_SETUP
Set DB_UTM = New DB_UT_MANTENIMIENTOS.C_PROCESOS

Mstrsql = "Select PASSWORD from se_userrec where USERID='" & GCUSERID & "'"

lblbmensaje.Caption = "El password debe contener al menos 8 caracteres de longitud." + vbCrLf + _
                       "Su nuevo password no puede ser ninguno de los 12 passwords previos ingresados." + vbCrLf + _
                       "El password debe ser la combinación de letras, números y símbolos." + vbCrLf + _
                       "Ingrese su password teniendo en consideración estos requerimientos."



End Sub

Private Sub txtantclave_LostFocus()
   
   ' Set Mrs = Util.Auxiliar3(Mstrsql)
    
   ' If UCase(Trim(txtantclave.Text)) <> UCase(Trim(Mrs!Password)) Then
   '    MsgBox "La clave ingresada no coincide con su clave Actual", vbDefaultButton1 + vbExclamation, "Mensaje"
   '    txtantclave.Text = Empty
   ' End If
      
  
End Sub

Public Sub salir_formulario()
    Unload Me
End Sub


