예제 #1
0
 public static IUserData ToUserInfo(this IdentityUserDto user)
 {
     return(new UserData(
                user.Id,
                user.UserName,
                user.Email,
                user.EmailConfirmed,
                user.PhoneNumber,
                user.PhoneNumberConfirmed,
                user.TenantId
                ));
 }
예제 #2
0
        public async Task <bool> UpdateProfile(Volo.Abp.Identity.IdentityUserDto userDto)
        {
            var user = await UserManager.GetByIdAsync(CurrentUser.GetId());

            user.Name = userDto.Name;
            (await UserManager.SetUserNameAsync(user, userDto.UserName)).CheckErrors();
            await UserManager.SetEmailAsync(user, userDto.Email);

            user.Surname = user.Name;
            user.SetPhoneNumber(userDto.PhoneNumber, true);
            await UserManager.UpdateAsync(user);

            return(true);
        }
예제 #3
0
        public async Task <Volo.Abp.Identity.IdentityUserDto> FindByIdAsync(Guid id)
        {
            var identityUser = await UserManager.GetByIdAsync(id);

            var identityUserDto = new Volo.Abp.Identity.IdentityUserDto()
            {
                UserName    = identityUser.UserName,
                Name        = identityUser.Name,
                Email       = identityUser.Email,
                PhoneNumber = identityUser.PhoneNumber,
            };

            return(identityUserDto);
        }
예제 #4
0
        public async Task <bool> UpdateProfileWithPassword(Volo.Abp.Identity.IdentityUserDto userDto, string newPassword)
        {
            var user = await UserManager.FindByIdAsync(userDto.Id.ToString());

            var isExistPassword = await UserManager.CheckPasswordAsync(user, newPassword);

            if (!isExistPassword)
            {
                var token = await UserManager.GeneratePasswordResetTokenAsync(user);

                await UserManager.ResetPasswordAsync(user, token, newPassword);
            }
            user.Name = userDto.Name;
            await UserManager.UpdateAsync(user);

            return(true);
        }
예제 #5
0
        public async Task LoginAsync(Volo.Abp.Identity.IdentityUserDto userDto)
        {
            var user = await UserManager.FindByIdAsync(userDto.Id.ToString());

            await SignInManager.SignInAsync(user, false);
        }