Ejemplo n.º 1
0
        public IActionResult Register(string usr, string mail, string pss)
        {
            ViewBag.Completed = false;

            if (usr == null)
            {
                return(View());
            }
            ViewBag.Successfull = false;
            ViewBag.Mail        = mail;

            var mailRegex = new Regex("^.+@.+[.].+$");

            usr  = usr.TrimName().MakeSafe();
            mail = mail.MakeSafe();

            // Add to Registrator list
            if (pss != null && mail != null && usr != null &&
                mailRegex.IsMatch(ViewBag.Mail) &&
                Registrator.Add(usr, mail, pss))
            {
                ViewBag.Successfull = true;
            }

            ViewBag.Completed = true;

            return(View());
        }