Ejemplo n.º 1
0
        public async Task <bool> CheckRegEmail(RegData err, ForumContext context)
        {
            if (Email == "")
            {
                err.Email = "Email is required";
                return(false);
            }
            else if (Email.Length >= 50)
            {
                err.Email = "Email is too long";
                return(false);
            }
            else if (!IsValidEmail(Email))
            {
                err.Email = "Email is invalid";
                return(false);
            }
            else if ((await context.GetUserByEmail(Email)) != null)
            {
                err.Email = "Email is already in use";
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public async Task <bool> CheckRegData(RegData err, ForumContext context)
        {
            var checkUsername = await CheckRegUsername(err, context);

            var checkEmail = await CheckRegEmail(err, context);

            var checkPassword = CheckRegPassword(err);

            return(checkUsername && checkEmail && checkPassword);
        }
Ejemplo n.º 3
0
        public bool CheckRegPassword(RegData err)
        {
            if (Password == "")
            {
                err.Password = "******";
                return(false);
            }
            else if (Password.Length >= 50)
            {
                err.Password = "******";
                return(false);
            }
            else if (Password.Length < 6)
            {
                err.Password = "******";
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        public async Task <bool> CheckRegUsername(RegData err, ForumContext context)
        {
            if (Username == "")
            {
                err.Username = "******";
                return(false);
            }
            else if (Username.Length >= 20)
            {
                err.Username = "******";
                return(false);
            }
            else if ((await context.GetUserByUsername(Username)) != null)
            {
                err.Username = "******";
                return(false);
            }

            return(true);
        }