Using lotusscript to make someone enter Notes password before running agent...how?

Hi all,

I have an approve button on a form. The user requires so when the button is click the user is logged out (like an F5) and then the user has to log in and then the approval code can run.

This is to stop people who are not the authorised approver, going onto an unlocked PC and approving it as the person who was logged in.

I have has a go at using some api calls to perform an F5 key press just before I call the ‘Approval’ agent to run but this doesn’t work very well as it finishes running the code and THEN performs the log out/F5.

Is there a way I can grab the users hashed Notes password, give them a password prompt box to enter, compare the two, and then based on if its correct, continue with calling the approve agent??

I want to avoid creating my own set of user names and passwords just for this database.

How can I get a hold of the users Notes password? Is it in the ini file? person document somewhere?

Any help would be appreciated on this.

Subject: Using lotusscript to make someone enter Notes password before running agent…how??

I don’t think there is a Lotusscript equivalent but you can use @Command([ToolsUserLogoff]); in formula language.

Subject: Using lotusscript to make someone enter Notes password before running agent…how??

As an alternative, I came up with a method that doesn’t require any use of API’s. It’s kind of a roundabout method, but the only way I could find to use the @Command [ToolsUserLogoff] from within script.

I created a form called “ForceLogin”. Only one field on the form, SaveOptions, Computed to “0”.

Postopen event contains script: “Call Source.Close”

QueryClose event contains formula: “@Command( [ToolsUserLogoff] )”

Effectively, if you try to create this document, it immediately closes again and invokes the logoff (equivalent to F5).

My approval code contains the following:

Call uiws.ComposeDocument("", "", "ForceLogin")

which forces the user to reauthenticate with their password.

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

cheeky little solution there stephen but i have tried it and after the

uiws.ComposeDocument(“”, “”, “ForceLogin”)

I have a call to do some approval stuff in a sub.

ws.ComposeDocument(“”, “”, “ForceLogin”)

call ApproveDoc(doc, true, false)

This runs before the log out has been done.

Can you give me some more info on how you got this working?

Thanks

Eliese

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

I had to play with it a bit. Basically, the password prompt doesn’t come up until you do something that actually tries to read or write the database. So if your approval agent is doing some processing on the document that’s already in memory, it can go a while before it does something that causes the password prompt.

You may find it useful to add a step at the beginning of your “ApproveDoc” function that does something (like opening a database or another document) that will require it to authenticate. Then you should see the password prompt before the rest of your approival logic executes.

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

Eliese,

You may also have luck with the SwitchToID method

http://www-12.lotus.com/ldd/doc/domino_notes/6.5.1/help65_designer.nsf/855dc7fcfd5fec9a85256b870069c0ab/f57c02be6f53aa8e85256e00004ab1bf?OpenDocument

I have not tried, but…

Subject: Using lotusscript to make someone enter Notes password before running agent…how??

The Notes password is not stored anywhere. It is merely a seed for a decryption key for the private portions of the notes ID file. That is, if the ID file is successfully decrypted, then the user must have entered the correct password (or one that creates an identical hash). You could, conceivably, compare an entered value to the HTTP password, but that is vulnerable to attack by anyone with sufficient access to names.nsf.

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

Hi Stan,Thanks for your reply.

I did think about the HTTP password option but not sure about it yet. I think I would prefer to create a profile document for each of the users in the database with a hashed password protected with readers fields.

Another option (if this is possible) would be to capture the last log in time for a user. So say I am working all morning on Notes my last log in time would be 9am… if at 10:30 I hit F5 and locked Notes, then logged back in at 10:45…I could grab this value (provided it is stored somewhere) and when I am running my code, if the last log in time is more than 30 seconds ago I can run my ‘press f5’ code, if its less than 30 seconds ago then run the approval agent. Not elegant but it would work.

So my next question is…is the last log in time for a user stored anywhere?

Subject: Using lotusscript to make someone enter Notes password before running agent…how??

You could use the C API SECKFMOpen call to open an ID file. This requires the correct password of the user for the call to succeed.

This way you can check the password of the ID file.

cheers,

Bram

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

Hi Bram,

Hope you are still reading this thread.

This sounds so great. Can you get a handle on if the correct password has been provided?

Do you have any sample code at all. Sorry to be a pain but I’ve never used and C API calls so not sure where to start

Thanks a million

xx

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

Here’s a good way to get started with using the C API from LotusScript:

 LotusScript to Lotus C API Programming Guide

-rich

Subject: RE: Using lotusscript to make someone enter Notes password before running agent…how??

Hi Eliese,

I’ve posted some code about this issue in a different thread:

http://www-10.lotus.com/ldd/nd6forum.nsf/0/d1aa76f7227c9072852573b00032a5ea?OpenDocument

It will require some tweaking for your situation (getting the actual path of the ID file in use), but should be pretty much copy/paste for the API part.

cheers,

Bram