SetLoginName

Description

Changes the login name of the current user. Can also change the password of the current user if a value is specified. Neither argument is optional.

This method can be used to support MultiSite operations, and can be used to resolve ambiguous names.

To detect whether there are multiple users with the same name on other sites, you can use the GetDisplayNamesNeedingSiteExtension method in Session. For example, a user named "Tom" might have been created on more than one site.

There is no return value. Changes take effect at the next login.

Syntax

VBScript


user.SetLoginName new_name, new_password 

Perl


user->SetLoginName(new_name, new_password); 
Identifier
Description
user
A User object.
new_name
A String containing a new or existing user name.
new_password
A String containing a new password.
Return value
None.

Example

Perl


# change a user login name and password using SetLoginName
use CQPerlExt;
my $adminSession = CQAdminSession::Build();

   ($newusername, $newpasswd, $cqdb) = @ARGV;
   $adminUser = "admin";
   $adminPasswd = "";
   $adminSession->Logon($adminUser, $adminPasswd, ""); 
   $userobj = $adminSession->GetUser($user);
   $userobj->SetLoginName($newusername, $newpasswd);
   $dbobj= $adminSession->GetDatabase($cqdb);
   $dbobj->UpgradeMasterUserInfo();

CQAdminSession::Unbuild($adminSession);