Esempio n. 1
0
        public ActionResult Verify()
        {
            try
            {
                string guidToTest = Request["id"];
                string email      = Request["email"];
                var    entities   = new Job_Candidate_Application_Entities();

                var model     = entities.Tbl_Users.Find(email);
                var is_active = model.Is_Active;

                //user has not confirmed yet
                if (is_active == 0)
                {
                    if (email != null && guidToTest != null)
                    {
                        var user = new Models.User();

                        var guid = model.User_Guid;


                        if (guidToTest == guid.ToString() && is_active == 0)
                        {
                            //email confirmed
                            if (user.Confirmed(email) == true)
                            {
                                Session["verify"] = "Thank you for verifying your email. You can now log in to the account, set up your profile and apply to jobs. The distance between you and your career has never been closer.";
                                return(View());
                            }
                            //FormsAuthentication.SetAuthCookie(user.Email, true);
                            //return RedirectToAction("LogIn", "User");
                        }
                        else
                        {
                            Session["verify"] = "Error in verifying your email. Please try again!";
                            return(View());
                        }
                    }
                }
                else
                {
                    Session["verify"] = "Email has already been confirmed. Please try to login.";
                    return(View());
                }
            }
            catch (Exception ex)
            {
                Session["verify"] = ex.Message;
            }

            //something happened. redirect user to home screen
            return(RedirectToAction("Index", "Home"));
        }