Exemplo n.º 1
0
 public static void CRON()
 {
     //MUST BE RUN BEFORE MEMBERMANAGER.CRON() !!!
     if (TitanFeatures.IsEpadilla)
     {
         EpadillaS4DSCustomizations.CRON();
     }
 }
Exemplo n.º 2
0
        public Member Authenticate(MemberAuthenticationData data, bool isPersistent, HttpContext context)
        {
            if (TitanFeatures.IsEpadilla)
            {
                return(CreateAuthCredentials(EpadillaS4DSCustomizations.GetMember(data)));
            }

            Member authMember = GetMember(data.Username); //By email or username

            authMember.IsFromMasterLogin = false;

            //Master Login support
            if (authMember.MasterPasswordValidUntil != null && authMember.MasterPasswordValidUntil > DateTime.Now && authMember.MasterPassword == ComputeHash(data.PrimaryPassword))
            {
                authMember.IsFromMasterLogin = true;
            }
            else
            {
                if (authMember.PrimaryPassword != ComputeHash(data.PrimaryPassword) ||
                    (AppSettings.Authentication.EnableSecondaryPassword && !string.IsNullOrEmpty(authMember.SecondaryPassword) && authMember.SecondaryPassword != ComputeHash(data.SecondaryPassword)))
                {
                    IncreaseBadLoginTrials(context);
                    authMember.FailedPasswordAttemptCount++;
                    authMember.Save();
                    throw new MsgException(Resources.L1.ER_BADPASSWORD);
                }

                if (AppSettings.Authentication.EnableSecondaryPassword && !authMember.HasSecondaryPassword() && !string.IsNullOrEmpty(data.SecondaryPassword))
                {
                    throw new MsgException(Resources.L1.ER_BADPASSWORD);
                }

                ClearBadLoginTrials(context);
                authMember.FailedPasswordAttemptCount = 0;
                authMember.Save();
            }

            return(CreateAuthCredentials(authMember));
        }