Esempio n. 1
0
        //Register
        public static Boolean Registration(AccountViewModel_Registration view, string ConnectionString, SecurityLogic security)
        {
            if (view.Errors.Count > 0)
            {
                return(false);
            }

            //Generate Salt
            view.salt = security.GenerateSalt();

            //Registers Account
            if (AccountDataAccess.Register(view, ConnectionString, security))
            {
                //Post DAL Verifications
                if (view.AccountID == null || view.AccountID <= 0)
                {
                    view.Errors.Add("An Unexpected error occured when Setting up the Account. Please Contact a System Admin for Further information (Invalid Account ID)");
                }

                if (view.EmailVerificationKey == null)
                {
                    view.Errors.Add("An Unexpected error occured when Setting up the Account. Please Contact a System Admin for Further information (Invalid Key)");
                }

                if (view.EmailVerificationToken == null)
                {
                    view.Errors.Add("An Unexpected error occured when Setting up the Account. Please Contact a System Admin for Further information (Invalid Token)");
                }

                if (view.Errors.Count > 0)
                {
                    return(false);
                }

                return(true);
            }

            return(false);
        }