Пример #1
0
        // 2
        public async Task <UserDTO> LoginUser(string email, string password)
        {
            string passwordHash = CryptoExtension.ToMD5(password);

            var user = await _userRepository.GetUserByEmail(email);

            if (user?.Password == passwordHash && user?.Email == email && user.IsConfirmed)
            {
                return(_mapper.Map <UserDTO>(user));
            }

            return(null);
        }
Пример #2
0
        public async Task <UserDTO> AddNewUser(UserDTO userDTO, string header)
        {
            var user = _mapper.Map <User>(userDTO);

            user.IdentityToken = CryptoExtension.ToMD5(RandomToken.RandomString(10));
            user.Password      = CryptoExtension.ToMD5(user.Password);

            var newUser = await _userRepository.Create(user);

            if (newUser == null)
            {
                return(null);
            }

            //  EmailExtension.sendEmail(newUser, url);

            return(_mapper.Map <UserDTO>(newUser));
        }
Пример #3
0
 internal EncryptedQueueRefiller(CryptoExtension _enclosing)
 {
     this._enclosing = _enclosing;
 }