Example #1
0
        public static XVar doGuestLogin()
        {
            dynamic allowGuest = null;

            allowGuest = XVar.Clone(CommonFunctions.guestHasPermissions());
            if (XVar.Pack(!(XVar)(allowGuest)))
            {
                return(null);
            }
            CommonFunctions.DoLogin(new XVar(true));
            return(null);
        }
Example #2
0
        public virtual XVar LogIn(dynamic _param_pUsername, dynamic _param_pPassword, dynamic _param_skipPasswordCheck = null, dynamic _param_fireEvents = null)
        {
            #region default values
            if (_param_skipPasswordCheck as Object == null)
            {
                _param_skipPasswordCheck = new XVar(false);
            }
            if (_param_fireEvents as Object == null)
            {
                _param_fireEvents = new XVar(true);
            }
            #endregion

            #region pass-by-value parameters
            dynamic pUsername         = XVar.Clone(_param_pUsername);
            dynamic pPassword         = XVar.Clone(_param_pPassword);
            dynamic skipPasswordCheck = XVar.Clone(_param_skipPasswordCheck);
            dynamic fireEvents        = XVar.Clone(_param_fireEvents);
            #endregion

            dynamic data = XVar.Array(), strPassword = null, strUsername = null;
            if (XVar.Pack(!(XVar)(checkCaptcha())))
            {
                return(false);
            }
            strUsername = XVar.Clone(pUsername);
            strPassword = XVar.Clone(pPassword);
            data        = XVar.Clone(getUserData((XVar)(pUsername), (XVar)(pPassword), (XVar)(skipPasswordCheck)));
            if (XVar.Pack(data))
            {
                dynamic pDisplayUsername = null;
                pDisplayUsername = XVar.Clone((XVar.Pack(data[GlobalVars.cDisplayNameField] != "") ? XVar.Pack(data[GlobalVars.cDisplayNameField]) : XVar.Pack(strUsername)));
                CommonFunctions.DoLogin(new XVar(false), (XVar)(pUsername), (XVar)(pDisplayUsername), new XVar(""), new XVar(Constants.ACCESS_LEVEL_USER), (XVar)(pPassword), this);
                if (XVar.Pack(!(XVar)(this.twoFactAuth)))
                {
                    CommonFunctions.SetAuthSessionData((XVar)(pUsername), (XVar)(data), new XVar(false), (XVar)(pPassword), this, (XVar)(fireEvents));
                }
                else
                {
                    XSession.Session["firsAuthStepData"] = data;
                }
                return(true);
            }
            if (XVar.Pack(fireEvents))
            {
                doAfterUnsuccessfulLog((XVar)(pUsername));
            }
            return(false);

            return(null);
        }