Cannot execute ChangeHTTPPassword

I made a web page with a simple to change user Web password. Here it is the agent:

Set currentDoc = session.DocumentContext

POSTparameters = currentDoc.Request_Content(0)

oldPassword = value = decodeQueryString(POSTparameters, "oldPassword")

newPassword = value = decodeQueryString(POSTparameters, "newPassword")

newPassword2 = value = decodeQueryString(POSTparameters, "newPassword2")



Set adminp = session.CreateAdministrationProcess("")

noteID$ = adminp.ChangeHTTPPassword(currentDoc.remote_user(0), oldPassword, newPassword)

Msgbox("Eureka!")

If noteID$ <> "" Then

	Dim db As New NotesDatabase(session.CurrentDatabase.Server, "admin4.nsf")

	Dim ws As New NotesUIWorkspace

	Call ws.EditDocument(False, db.GetDocumentByID(noteID$))

End If

But when after I submit the form I see this message on the server console “HTTP Server: Agent ‘ChangeHTTPPasswor’ error: Notes error: You are not authorized to perform that operation”. Agent is set with runtime security level 3 (Allow restricted operations with full administration rights’. I thought it was a problem with Current Server Document, but I belong to a group available in the field ‘Run unrestricted methods and operations’. Any suggestions?

Thanks

Subject: Cannot execute ChangeHTTPPassword

I am not sure what you are trying to do but your code seems a combination of webcode and client code?

oldPassword = value = decodeQueryString(POSTparameters, “oldPassword”) <–this looks strange too.

Are you trying to write oldPassword = decode QueryString…

newPassword = value = decodeQueryString(POSTparameters, “newPassword”)

newPassword2 = value = decodeQueryString(POSTparameters, “newPassword2”) Set adminp = session.CreateAdministrationProcess(“”)

noteID$ = adminp.ChangeHTTPPassword(currentDoc.remote_user(0), oldPassword, newPassword)

Msgbox(“Eureka!”)–>this does not run in the browser!!

If noteID$ <> “” Then

Code below cannot be run like that,. it is UIcode which can only run in the client

Dim db As New NotesDatabase(session.CurrentDatabase.Server, “admin4.nsf”)

Dim ws As New NotesUIWorkspace

Call ws.EditDocument(False, db.GetDocumentByID(noteID$))

You also need access to create documents in Admin4.nsf

So you might have to do some tidying up before your problem can be fixed! :slight_smile:

Subject: RE: Cannot execute ChangeHTTPPassword

Hi Marjan, you’re right. The code I posted is not clear and after some test I finally solved my problem with ChangeHTTPPassword.What I was trying to do is this. Create a web page so Domino user can change their web password. All data in the web page are submitted to a Lotus agent using a POST call.

The variable POSTparameters in my piece of code is actually the string with all parameters submitted by web page and decodeQueryString is a function I created to extract the value of a specific parameter available in POSTparameters. (I.e. decodeQueryString(POSTparameters, “oldPassword”) find oldPassword=VALUE inside string POSTparamenters). Then UI part is not necessary - it was a copy/paste from ChangeHTTPPAssword example - as you wrote, UI is not available on web.

By the way, the following is the working code I used right now:

Dim session As New NotesSession

Dim adminp As NotesAdministrationProcess

Dim currentUser As String

Dim currentDoc As NotesDocument

Dim POSTparameters As String

Dim oldPassword, newPassword, newPassword2 As String



Set currentDoc = session.DocumentContext

If Not (currentDoc Is Nothing) Then

	POSTparameters = currentDoc.Request_Content(0)

	oldPassword = decodeQueryString(POSTparameters, "oldPassword")

	newPassword = decodeQueryString(POSTparameters, "newPassword")

	newPassword2 = decodeQueryString(POSTparameters, "newPassword2")

	currentUser = currentDoc.Remote_User(0)

Else

	currentUser = session.UserName

End If



Set adminp = session.CreateAdministrationProcess("Server/Server") '<-- Write here the name of server where you want to create an Admin process

noteID$ = adminp.ChangeHTTPPassword(currentUser, oldPassword, newPassword)

I cannot run this agent, because two problems:

  1. I was trying to create an admin process in a server where I thought I had rights, but due to a wrong typing my usedID was not correct.

  2. After I was able to create an admin process on a server, I found the process did nothing. I changed the target server (I use our main server, instead our test server) and now the code works.

Hope this post is more clear.

Thanks