Discussions

Ask a Question
Back to All

Is there a way to change a username (via API) without automatically sending the user an email?

Hello, the MembershipWebService has a ChangeUsername function (with parameters for the old username and new username), and this works fine. However, it automatically sends an email to the user notifying them of the update, and including their new automatically-generated password in PLAINTEXT. (This is for 20.2.64.8807.)

We've been asked to not send the email at all, if possible. The use case is that we are importing data into iMIS with some people supplying a new email address (we use email as username).

If we have to send the email, we'd at least like to customize it or have it not send the new password in plaintext, and instead include a link for resetting the password.

My guess is that the web service implementation is calling the AsiMembershipProvider.ChangeUsername overload that only takes old and new usernames as parameters, which then calls the other ChangeUsername function, passing true for the sendChangeEmail parameter value. Ideally, we'd like the web service to implement ChangeUsername(string oldUsername, string newUsername, bool sendChangeEmail), so we can specify whether or not we want to send the email.

Do you have any suggestions for how to not send the email? Is there a REST endpoint for changing username? I haven't been able to find one.

Any advice on how to not send the automatic email or to change it so it doesn't include the password would be great.

Thanks,
Jamal

Admin

Hi Jamal,

I don't believe it's possible to update the email via the REST API. However, a fix for that issue was released in Service Pack F. Are you able to install that service pack to resolve the issue?

Thanks,
Andrea

Hello Andrea,

Thanks for the quick response. I'm able to change the email on the record just fine using the Membership Web Service call to UpdateParty. I just need to also update the username to that same email value.

Can you please send me a link to the documentation for the Rest API function that updates email? And can you also please send me a link to the ticket in the Completed Defects forum for the issue where it was completed?

Thank you,
Jamal

Admin

Hello Jamal,

On 20.2.64 you will only be able to do this through the MembershipWebService. If you were able to upgrade to our cloud instance, REST is an option with the UserSecurity Endpoint
I took a look at the MembershipWebService and your guess is correct. As I can see, there is a function in there that would set the false you are asking about but this is only available if you know the current password of the user by logging in as the user and calling: ChangeUsername(string newUsername, string password). To do this in a single step you can do this as well with ChangeUsernameWithLogin(string newUsername, string password, string loginAsUser, string loginPassword) to provide the log-in details at the same time.

Since you mention the use of the MembershipWebService, are you making any custom pages as well? if so, it would be possible to create a custom reset password page using the above method where the link would bring them to a page where they can set the username they desire and the new password.

Hope this information helps.

Hello Cesar,

I do see the UserSecurity REST endpoint, and I'm able to code calls to it, but I'm getting a "Service not implemented" exception. Is that because of our version? Or is it because we are on -300 and not on the cloud implementation of iMIS? Because "upgrading" to cloud isn't going to work for us.

With the MembershipWebService, are you saying that calling ChangeUsernameWithLogin will not send the email?

The real issues are that the email gets sent and contains a password in plaintext. If we can not send the email, that would be best. But if we have to, then at least being able to change the email to not send the password would be ok. Are either of these options possible?

To answer your question, we are not making custom pages--this is for bulk importing of data from Excel that includes email changes. We do have a custom iPart to change the email and username together, that users have available on their profile--but that doesn't work for this use-case.

Thanks for your time on this issue, I appreciate the help.

-Jamal

Admin

You are correct, the UserSecurity endpoint is only available on the cloud version of 300 (iMIS Cloud Enterprise) and the 100-200 version (iMIS Cloud Profesional). And as well correct on ChangeUsernameWithLogin, this method will not send an email but has the caveat that you will need to have the current login information for the user and provide a new username and a new password to be changed. This would be the only way to avoid sending an email on the version you are on. Another way an email does not get sent is if the user does not have an email at the time of changing the username. You may be able to use the email as the username but not have it added as an email until after the usernames have been imported. This would however require an additional step to add emails.

ο»Ώ

Contact us
Copyright Β© Advanced Solutions International, All rights reserved.