コード例 #1
0
 public async Task<ActionResult> SignUp(SignUpDto user)
 {
     if (!await _userProvider.IsEmailAvailableAsync(user.Email))
     {
         ModelState.AddModelError("Email", ValidationMessages.ResourceManager.GetString("SignUpEmailRemote"));
     }
     if (!await _userProvider.IsLoginAvailableAsync(user.Login))
     {
         ModelState.AddModelError("Login", ValidationMessages.ResourceManager.GetString("SignUpLoginRemote"));
     }
     if (ModelState.IsValid)
     {
         await _userProvider.CreateNewUserAsync(user);
         // TODO send email
         return View("SignUpConfirmation");
     }
     else
         return View();
 }
コード例 #2
0
        public async Task CreateNewUserAsync(SignUpDto signUpDto)
        {
            User user = new User
            {
                Email = signUpDto.Email,
                Login = signUpDto.Login,
                Password = PasswordHash.CreatePasswordHash(signUpDto.Password),
                ActivatedToken = PasswordHash.GenerateToken(),
                Sid = PasswordHash.GenerateToken()
            };
//            System.Diagnostics.Debug.WriteLine("Password " + user.Password.Length);
            await _userRepository.CreateUserAsync(user);
        }