Example #1
0
    public static int CheckIfMemberPartial(string username, string email)
    {
        try
        {
            using (var member = new memberWSSoapClient())
            {
                return(member.MemberPartialRegistration(long.Parse(commonVariables.OperatorId), username, email));
            }
        }
        catch (Exception ex)
        {
            commonAuditTrail.appendLog("system", "Forgot Password", "CheckIfMemberPartial", string.Empty, string.Empty, string.Empty, "-99", "exception", ex.Message, string.Empty, string.Empty, true);
        }

        return(0);
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xeErrors = commonVariables.ErrorsXML;
        commonCulture.appData.getRootResource("/_Secure/Login.aspx", out _xeLoginResources);

        lblRegister.Text         = commonCulture.ElementValues.getResourceString("lblRegister2", _xeLoginResources);
        lblRegNote.Text          = commonCulture.ElementValues.getResourceString("lblMsgNote", _xeLoginResources);
        lblUsername.Text         = commonCulture.ElementValues.getResourceString("lblUsername", _xeLoginResources);
        lblPassword.Text         = commonCulture.ElementValues.getResourceString("lblPassword", _xeLoginResources);
        lblCaptcha.Text          = commonCulture.ElementValues.getResourceString("lblCaptcha", _xeLoginResources);
        hfLoginTranslation.Value = commonCulture.ElementValues.getResourceString("btnLogin", _xeLoginResources);

        try
        {
            if (Request.QueryString["username"] != null && Request.QueryString["code"] != null)
            {
                using (var client = new memberWSSoapClient())
                {
                    commonAuditTrail.appendLog(_username, "_Secure_AutoLogin", "Params", string.Empty, string.Empty,
                                               string.Empty, "-99", string.Empty, Request.Url.ToString(),
                                               string.Empty, string.Empty, true);

                    commonCookie.CookieIsApp = "1";
                    var palazzoPrefix = ConfigurationManager.AppSettings.Get("palazzo_account_prefix");
                    var rawUsername   = Request.QueryString["username"];
                    var token         = Request.QueryString["code"];
                    _username = Request.QueryString["username"].StartsWith(palazzoPrefix)
                        ? Request.QueryString["username"].Remove(0, palazzoPrefix.Length)
                        : Request.QueryString["username"];

                    commonAuditTrail.appendLog(_username, "_Secure_AutoLogin", "Params", string.Empty, string.Empty,
                                               string.Empty, "-99", string.Empty, string.Format("{0}|{1}|{2}", rawUsername, _username, token),
                                               string.Empty, string.Empty, true);

                    var dsData = client.MemberAutoSigninFromApp(Convert.ToInt64(commonVariables.OperatorId), _username,
                                                                rawUsername, token,
                                                                Request.Url.ToString(), Request.UserHostAddress, Session.SessionID);

                    commonAuditTrail.appendLog(_username, "_Secure_AutoLogin", "Response", string.Empty, string.Empty, string.Empty, "-99", string.Empty, dsData.Tables.Count.ToString(), string.Empty, string.Empty, true);

                    if (dsData.Tables.Count > 0 && dsData.Tables[0].Rows.Count > 0)
                    {
                        var result = int.Parse(dsData.Tables[0].Rows[0]["RETURN_VALUE"].ToString());
                        commonAuditTrail.appendLog(_username, "_Secure_AutoLogin", "ReturnValue", string.Empty, string.Empty, string.Empty, "-99", string.Empty, result.ToString(), string.Empty, string.Empty, true);

                        if (result == 1)
                        {
                            new Members().SetSessions(dsData.Tables[0], null);

                            Response.Redirect(
                                !string.IsNullOrEmpty(Request.QueryString.Get("redirect"))
                                    ? Request.QueryString.Get("redirect")
                                    : "/Funds.aspx", false);
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            commonAuditTrail.appendLog(_username, "_Secure_AutoLogin", "Page_Load", string.Empty, string.Empty,
                                       string.Empty, "-99", ex.InnerException.ToString(), ex.Message, string.Empty, string.Empty, true);
            Response.Redirect(
                !string.IsNullOrEmpty(Request.QueryString.Get("redirect"))
                                   ? Request.QueryString.Get("redirect")
                                   : "/Funds.aspx", false);
        }
    }
Example #3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        var email        = txtEmail.Text;
        var username     = txtUsername.Text;
        var secureAnswer = txtSecurityAnswer.Text;

        var lastSentTime = DateTime.MinValue;

        if (!string.IsNullOrEmpty((string)HttpContext.Current.Session["forgot_login"]))
        {
            lastSentTime = DateTime.ParseExact((string)HttpContext.Current.Session["forgot_login"], "yyyy-MM-dd HH:mm:ss", null);
        }
        if (HttpContext.Current.Request.Cookies["forgot_login"] != null)
        {
            var cookieTime = DateTime.ParseExact((string)HttpContext.Current.Request.Cookies["forgot_login"].Value, "yyyy-MM-dd HH:mm:ss", null);
            if (cookieTime > lastSentTime)
            {
                lastSentTime = cookieTime;
            }
        }

        if (DateTime.Now.AddMinutes(-1) < lastSentTime)
        {
            var ts = lastSentTime - DateTime.Now.AddMinutes(-1);
            AlertMessage = commonCulture.ElementValues.getResourceString("Resent", XeResources).Replace("[min]", ts.Minutes.ToString()).Replace("[sec]", ts.Seconds.ToString());
            AlertCode    = "-1";
        }
        else if (string.IsNullOrEmpty(username))
        {
            AlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingUsername", XeErrors);
            AlertCode    = "-1";
        }
        else if (string.IsNullOrEmpty(email) || commonValidation.isInjection(email))
        {
            AlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingEmail", XeErrors);
            AlertCode    = "-1";
        }
        else if (commonValidation.isInjection(secureAnswer))
        {
            AlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingUsername", XeErrors);
            AlertCode    = "-1";
        }
        else
        {
            using (var memberWs = new memberWSSoapClient())
            {
                int secQue;
                int.TryParse(drpSecurityQuestion.SelectedValue, out secQue);

                var result = secQue == 0 ? memberWs.MemberForgotPasswordPartial(long.Parse(commonVariables.OperatorId), username, email) : memberWs.MemberForgotPassword(long.Parse(commonVariables.OperatorId), username, email, secQue, secureAnswer);

                switch (result)
                {
                case 1:
                    var myCookie = new HttpCookie("forgot_login")
                    {
                        Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                    };
                    HttpContext.Current.Response.Cookies.Add(myCookie);
                    AlertMessage = commonCulture.ElementValues.getResourceString("Success", XeResources);
                    AlertCode    = "1";
                    break;

                case 11:
                    AlertMessage = commonCulture.ElementValues.getResourceXPathString("ForgotPassword/NotExist", XeErrors);
                    AlertCode    = "0";
                    break;

                case 12:
                case 13:
                    AlertMessage = commonCulture.ElementValues.getResourceXPathString("ForgotPassword/IncorrectSecurity", XeErrors);
                    AlertCode    = "-1";
                    break;

                default:
                    AlertMessage = commonCulture.ElementValues.getResourceXPathString("ForgotPassword/Other", XeErrors);
                    AlertCode    = "0";
                    break;
                }
            }
        }
    }