FrmUserChangePwd.frm
4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
VERSION 5.00
Begin VB.Form FrmUserChangePwd
Caption = "Alteração de Senha"
ClientHeight = 2970
ClientLeft = 60
ClientTop = 345
ClientWidth = 3810
Icon = "FrmUserChangePwd.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2970
ScaleWidth = 3810
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame1
Height = 3045
Left = 0
TabIndex = 5
Top = -60
Width = 3825
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 345
Left = 2490
TabIndex = 10
Top = 2460
Width = 975
End
Begin VB.TextBox txtUsrPwd
Height = 345
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 1
Text = "txtUsrPwd"
Top = 810
Width = 1755
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Height = 345
Left = 270
TabIndex = 4
Top = 2430
Width = 975
End
Begin VB.TextBox txtUsrPwdNewCon
Height = 345
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 3
Text = "txtUsrPwd"
Top = 1860
Width = 1755
End
Begin VB.TextBox txtUsrLog
Enabled = 0 'False
Height = 345
Left = 1680
TabIndex = 0
Text = "txtUsrLog"
Top = 300
Width = 1755
End
Begin VB.TextBox txtUsrPwdNew
Height = 345
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 2
Text = "txtUsrPwd"
Top = 1320
Width = 1755
End
Begin VB.Label Label4
Caption = "Senha Atual"
Height = 315
Left = 180
TabIndex = 9
Top = 870
Width = 1155
End
Begin VB.Label Label1
Caption = "Confirme a Senha"
Height = 315
Left = 180
TabIndex = 8
Top = 1920
Width = 1335
End
Begin VB.Label Label2
Caption = "Usuário"
Height = 315
Left = 180
TabIndex = 7
Top = 360
Width = 1155
End
Begin VB.Label Label3
Caption = "Nova Senha"
Height = 315
Left = 180
TabIndex = 6
Top = 1380
Width = 1155
End
End
End
Attribute VB_Name = "FrmUserChangePwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private MyConn As ADODB.Connection
'Private MyUsers As Object
Private MyUsers As New NexusUsers.clsUsers
Private ChangePwd As Boolean
Public Function Init(Conn As ADODB.Connection, UserID As Long) As Boolean
Set MyConn = Conn
' Set MyUsers = CreateObject("NexusUsers.clsUsers")
With MyUsers.Users
If .SelectData(Conn, UserID) Then
txtUsrLog.Text = .UsrLog
txtUsrPwd.Text = ""
txtUsrPwdNew.Text = ""
txtUsrPwdNewCon.Text = ""
End If
End With
Me.Show vbModal
Init = ChangePwd
Set MyUsers = Nothing
End Function
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
With MyUsers.Users
If txtUsrPwd.Text = .UsrPwd Then
If txtUsrPwdNew.Text = txtUsrPwdNewCon.Text Then
.UsrPwd = txtUsrPwdNew.Text
.UpdateData MyConn
ChangePwd = True
Unload Me
Else
MsgBox "Campos nova senha e confirmação não são iguais", vbExclamation
End If
Else
MsgBox "Senha atual inválida", vbExclamation
txtUsrPwd.Text = ""
End If
End With
End Sub