Esempio n. 1
0
 public void AddNewUser(RegisterUserViewModel userData)
 {
     var user = userData.ToEntity();
       var passwordSalt = _securityManager.GenerateNewSalt();
       var passwordHash = _securityManager.ComputeHash(passwordSalt, userData.Password);
       user.PasswordSalt = new BsonBinaryData(passwordSalt);
       user.PasswordHash = new BsonBinaryData(passwordHash);
       Users.Insert(user);
 }
Esempio n. 2
0
 public ActionResult RegisterNewUser(RegisterUserViewModel user)
 {
     if (!ModelState.IsValid)
     return View("Register", user);
       if (!string.Equals(user.Password, user.RepeatPassword))
       {
     ModelState.AddModelError(string.Empty, "passwords don't match");
     return View("Register", user);
       }
       if (_chatRepository.IsUserRegistered(user.Email))
       {
     ModelState.AddModelError("Email", "the email is not available");
     return View("Register", user);
       }
       _chatRepository.AddNewUser(user);
       AuthorizeUser(user.Email, user.RememberMe);
       return RedirectToAction("Index", "Chat");
 }
Esempio n. 3
0
 public ActionResult Register(RegisterUserViewModel user)
 {
     return View(user);
 }