コード例 #1
0
        public ActionResult SignIn(FormCollection formCollection)
        {
            SignInCollection signInCollection = new SignInCollection();

            signInCollection.Email    = formCollection["email"];
            signInCollection.Password = formCollection["password"];
            if (signUp.IsEmailExist(formCollection["email"]))
            {
                if (signIn.IsPasswordCorrect(formCollection["email"], formCollection["password"]))
                {
                    Session["Email"] = formCollection["email"];

                    Response.Cookies.Add(signIn.CreateCookie(formCollection["email"], formCollection["password"]));
                    HttpContext.Response.SetCookie(signIn.CreateCookie(formCollection["email"], formCollection["password"]));
                    return(RedirectToAction("MyProfile", "MyProfile"));
                }
                else
                {
                    ViewBag.Error = "Incorrect Password";
                    return(View());
                }
            }
            else
            {
                ViewBag.Error = "Invalid Email";
                return(View());
            }
        }
コード例 #2
0
        public ActionResult SignUp(FormCollection formCollection)
        {
            SignUpCollection signUpCollection = new SignUpCollection();

            signUpCollection.Name            = formCollection["fullname"];
            signUpCollection.Email           = formCollection["email"];
            signUpCollection.Password        = formCollection["password"];
            signUpCollection.ConfirmPassword = formCollection["confirm"];
            if (!signUp.IsEmailExist(signUpCollection.Email))
            {
                signUp.AddUser(signUpCollection);
                return(RedirectToAction("Success"));
            }
            else
            {
                ViewBag.RemoteValidation = "Email is Already Existed";
                return(View());
            }
        }