Exemple #1
0
        public async Task CreateUser(CreateOrUpdateUserInput input)
        {
            ValidateEmail(input.EmailAddress);

            var user = input.MapTo<User>();

            user.TenantId = AbpSession.TenantId;
            user.Password = new PasswordHasher().HashPassword(input.Password);
            user.IsEmailConfirmed = true;

            CheckErrors(await UserManager.CreateAsync(user));
        }
Exemple #2
0
        public async Task UpdateUser(CreateOrUpdateUserInput input)
        {
            ValidateEmail(input.EmailAddress);

            var user = await UserManager.GetUserByIdAsync(input.Id);
            user = Mapper.Map(input, user);

            if (!String.IsNullOrEmpty(input.Password)) // password is ignored in mapping, check it separately
            {
                user.Password = new PasswordHasher().HashPassword(input.Password);
            }

            CheckErrors(await UserManager.UpdateAsync(user));
        }