Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompt for Notes password before continuing 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
Here is a helpful piece of code that I found at Notes.net (all thanks to Steve!) This code presents the users with the Notes Login Password prompt from your application and requires a successful password before continuing. Before you say "But they have already logged into Notes before getting to the application" here's Steve's reply to that:

And then they go off to the toilet and someone else walks up to their machine and order £20,000 of unwanted software...

So if you have any processes that you want to verify the user before continuing try this:

Dim ses As New NotesSession
Dim reg As New NotesRegistration
Dim MyID As String
Dim MyDir As String
Dim charPos As Integer

'Build the filepath to the existing ID
MyID = ses.GetEnvironmentString("KeyFilename", True)
MyDir = ses.GetEnvironmentString("Directory", True)

Dim nuserName As New NotesName(ses.UserName)
NotesUserName = nuserName.Abbreviated

charPos = Instr(1, MyID, "\")

If charPos = 0 Then ' Not found
build_str = MyDir + "\" + MyID
Else
build_str = MyID
End If

' If the user cancels the password prompt, then an error code will be generated. The On Error statement will redirect the program execution so that the error handling code will be executed. The resume statement will then control where program execution goes when the error handling routine is completed.

' If the valid password for the current user's Notes ID is entered, then no error code will be generated and the program will continue to execute program statements in their normal sequence.

On Error Goto SomeErrorRoutine
UserName = reg.SwitchToID(build_str)

I am currently working on making this into a Script to include with all my applications where needed and will keep this post updated with any changes or improvements!


Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top