Пример #1
0
        public IActionResult RegisterAdmin()
        {
            var user = _applicationUserRepository.FindByEmail("*****@*****.**");

            if (user.EmailId == null)
            {
                ApplicationUserViewModel AdminUser = new ApplicationUserViewModel()
                {
                    Name    = "Admin",
                    EmailId = "*****@*****.**",
                    //CreatedDateTime = DateTime.Now,
                    MobileNumber = "9423237999",
                    RoleId       = 1
                };
                using (var hmac = new System.Security.Cryptography.HMACSHA512())
                {
                    AdminUser.PasswordSalt = hmac.Key;
                    AdminUser.PasswordHash = hmac.ComputeHash(System.Text.Encoding.UTF8.GetBytes("Reset1234"));
                }
                _applicationUserRepository.Add(AdminUser);
            }
            return(RedirectToAction("Index", "Account"));
        }
Пример #2
0
        public ApplicationUserViewModel LoginAdmin(string email)
        {
            var user = _applicationUserRepository.FindByEmail(email);

            return(user);
        }
Пример #3
0
        public async Task <ApplicationUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            return(await userRepository.FindByEmail(normalizedEmail));
        }