示例#1
0
        public ActionResult CompleteRegistrationReq(Student s)
        {
            if (Session["completeRegEmail"] == null)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }
            if (s.EmailConfirmationPIN == null || s.FirstName == null || s.LastName == null || s.Username == null || s.Password == null)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }
            string Email = (string)Session["completeRegEmail"];
            string PIN   = data.GetEmailConfirmationPIN(Email);

            CompleteRegViewModel vm = new CompleteRegViewModel();

            vm.IsPinCorect       = PIN.Equals(s.EmailConfirmationPIN);
            vm.IsUsernameCorrect = !data.DoesUsernameExist(s.Username);

            if (vm.IsPinCorect && vm.IsUsernameCorrect)
            {
                s.EmailConfirmed = true;
                data.SaveStudentData(Email, s);
                return(RedirectToAction("Login", "Home"));
            }
            vm.Data = s;
            Session.Clear();
            Session["completeRegReq"] = vm;
            return(RedirectToAction("CompleteRegistration", new { Email = Email }));
        }
示例#2
0
 public ActionResult CompleteRegistration(string Email)
 {
     if (Email == null)
     {
         return(RedirectToAction("PageNotFoundError", "Home"));
     }
     if (!data.DoesStudentEmailExist(Email))
     {
         return(RedirectToAction("PageNotFoundError", "Home"));
     }
     if (data.DoesStudentEmailConfirmed(Email))
     {
         return(RedirectToAction("PageNotFoundError", "Home"));
     }
     if (Session["completeRegReq"] == null)
     {
         Session.Clear();
         Session["completeRegEmail"] = Email;
         return(View());
     }
     else
     {
         CompleteRegViewModel vm = (CompleteRegViewModel)Session["completeRegReq"];
         Session.Clear();
         Session["completeRegEmail"] = Email;
         return(View(vm));
     }
 }