Пример #1
0
        public ChangePasswordResponse ChangePassword(ChangePasswordRequest request)
        {
            request.NewPassword = HashingUtil.CalculateMD5Hash(request.NewPassword);
            request.OldPassword = HashingUtil.CalculateMD5Hash(request.OldPassword);
            var httpRequest = new JSONRestRequest("api/v3/accounts/change-password", Method.POST);

            httpRequest.AddBody(request);
            var response = Execute <ChangePasswordResponse>(httpRequest, HttpStatusCode.OK);

            return(response.Data);
        }
Пример #2
0
        public Session SignIn(string email, string password, Guid tenantID)
        {
            var request = new SignInRequest()
            {
                Email    = email,
                Password = HashingUtil.CalculateMD5Hash(password),
                TenantID = tenantID
            };

            return(SignIn(request));
        }
Пример #3
0
        public Session SignIn(string email, string password)
        {
            var request = new SignInRequest()
            {
                Email            = email,
                Password         = HashingUtil.CalculateMD5Hash(password),
                UseDefaultTenant = true
            };

            return(SignIn(request));
        }
Пример #4
0
 public void ResetPassword(ResetPasswordRequest request)
 {
     if (request.NewPassword.Length >= 4)
     {
         request.NewPassword = HashingUtil.CalculateMD5Hash(request.NewPassword);
         var httpRequest = new JSONRestRequest("api/v3/accounts/reset-password", Method.POST);
         httpRequest.AddBody(request);
         Execute(httpRequest, HttpStatusCode.OK);
     }
     else
     {
         throw new SDKServiceException("Password must be at least 4 characters long!", new ServiceErrror());
     }
 }
Пример #5
0
        public static RegistrationEntity CreateRegistrationEntity(string password = "******")
        {
            var tenantProvider      = ProviderFactory.Instance.CreateTenantServiceProvider();
            var registrationRequest = new RegistrationRequest();

            registrationRequest.Account = new Account();


            var tenant = new Tenant();

            tenant.DisplayName  = "fakeTenant";
            tenant.ID           = Guid.NewGuid();
            tenant.Code         = GenerateRandomString();
            tenant.Address      = new Address();
            tenant.Person       = new Person();
            tenant.Organization = new Organization();

            var account = registrationRequest.Account;

            account.AccountType  = EAccountType.Master;
            account.Email        = GenerateRandomString() + "@test.com";
            account.PasswordHash = HashingUtil.CalculateMD5Hash(password);
            account.Verified     = true;
            account.ID           = Guid.NewGuid();
            account.TenantID     = tenant.ID;
            account.Address      = new Address();
            account.Person       = new Person();

            tenantProvider.CreateTenantAndAccount(new RegistrationRequest()
            {
                Account = account,
                Tenant  = tenant
            });

            var entity = new RegistrationEntity()
            {
                Account         = account,
                Tenant          = tenant,
                AccountPassword = password
            };

            return(entity);
        }
Пример #6
0
        public static void ClassInit(TestContext context)
        {
            var tenantProvider      = ProviderFactory.Instance.CreateTenantServiceProvider();
            var registrationRequest = new RegistrationRequest();

            registrationRequest.Account = new Account();


            var tenant = new Tenant();

            tenant.DisplayName  = "fakeTenant";
            tenant.ID           = Guid.NewGuid();
            tenant.Code         = GenerateRandomString();
            tenant.Address      = new Address();
            tenant.Person       = new Person();
            tenant.Organization = new Organization();

            var account = registrationRequest.Account;

            account.AccountType  = EAccountType.Master;
            account.Email        = GenerateRandomString() + "@test.com";
            account.PasswordHash = HashingUtil.CalculateMD5Hash(_password);
            account.Verified     = true;
            account.ID           = Guid.NewGuid();
            account.TenantID     = tenant.ID;
            account.Address      = new Address();
            account.Person       = new Person();

            tenantProvider.CreateTenantAndAccount(new RegistrationRequest()
            {
                Account = account,
                Tenant  = tenant
            });

            _account = account;
            _tenant  = tenant;
        }
Пример #7
0
 public Collaborator(MailAddress mailAddress)
 {
     UserKey     = HashingUtil.CalculateMD5Hash(mailAddress.Address.ToLower());
     DisplayName = mailAddress.DisplayName ?? mailAddress.User;
 }