CheckAccountExpiration 方法示例

下列示例将检查用户的 Windows 帐户过期状态。如果该帐户过期,本示例将提示用户更改其密码(如果该用户有权更改)。如果该帐户尚未过期,则会显示一条消息,指出还剩多少天密码会过期。

Dim ESig As Object

Dim bNodeSignEnabled As Boolean

Dim UserName As String

Dim PassWord As String

Dim UsrId As String

Dim bExpired As Boolean

Dim daysLeft As Long

Dim bCanChangePassword As Boolean

'使用 Windows 安全性的 iFix 用户的用户名

UserName = "expire"

'创建 ESignature 对象

Set ESig = CreateObject("ElectronicSignature.ESignature")

'检查节点是否启用了电子签名

ESig.IsNodeSignEnabled bNodeSignEnabled

If bNodeSignEnabled = True Then

'检查帐户状态以及用户是否有权更改密码

ESig.CheckAccountExpiration UserName, bExpired, bCanChangePassword, daysLeft

If bExpired <> False Then

If bCanChangePassword <> False Then

ESig.PromptToChangePassword UserName

End If

Else

'密码未过期

MsgBox "Password is due to expire in " & daysLeft & " days."

End If

Else

'未对签名启用硬件密钥,已禁用安全性,或者已启用绕过签名

MsgBox "Signature is not enabled on this node."

End If

 

您最近了解过 iFIX 吗 ?

查看最新版 iFIX 的所有新功能。

让 iFIX 帮助您提高效率,降低成本。