Beispiel #1
0
        public ActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                Account account = new Account
                {
                    firstName  = model.firstName,
                    lastName   = model.lastName,
                    email      = model.email,
                    password   = model.password.Encrypt(model.email),
                    isVerified = false,
                    createDate = DateTime.Now,
                };

                var _account = accountDAL.FetchByEmail(account.email);

                if (_account != null)
                {
                    TempData["errorMessage"] = "Oops ! It appears that email is already in use ! ";
                    return(View(model));
                }

                accountDAL.createAccount(account);

                _email.SendEmailAddressVerificationEmail(account.email, account.email);

                return(View("RegConfirmation"));
            }
            return(View(model));
        }