Exemplo n.º 1
0
        public void ChangePassword(string username, string currentPassword,
                                   string newPassword)
        {
            NAAS_USRMGR.ChangePassword changePassword = new NAAS_USRMGR.ChangePassword();

            changePassword.userId               = username;
            changePassword.credential           = currentPassword;
            changePassword.domain               = _usermgrRuntimeCredentialDomain;
            changePassword.newPassword          = newPassword;
            changePassword.passwordConfirmation = newPassword;

            try
            {
                NAAS_USRMGR.ChangePasswordResponse response = _usermgrClient.ChangePassword(changePassword);
            }
            catch (Exception e)
            {
                throw new ArgException("NAAS returned an error: {0}", e.Message);
            }
        }
Exemplo n.º 2
0
        public static Exception ChangePassword(string username, string currentPassword, string newPassword,
                                               bool isProduction)
        {
            try
            {
                IUserMgr userManager = new UserMgr2Provider(isProduction);
                NAAS_USRMGR.ChangePassword changePassword = new NAAS_USRMGR.ChangePassword();

                changePassword.userId               = username;
                changePassword.credential           = currentPassword;
                changePassword.domain               = NAAS_USRMGR.DomainTypeCode.@default;
                changePassword.newPassword          = newPassword;
                changePassword.passwordConfirmation = newPassword;

                NAAS_USRMGR.ChangePasswordResponse response = userManager.ChangePassword(changePassword);

                return(null);
            }
            catch (Exception e)
            {
                return(e);
            }
        }