示例#1
0
        protected void login_Click(object sender, EventArgs e)
        {
            try
            {
                if (HttpContext.Current.Session != null)
                {
                    string pwdencoded;
                    canvBiz = new CanvasBizProcess();
                    string un = txtemail.Text;
                    string pwd = txtpassword.Text;
                    EncryptionUtilities _oEncryptionUtilities = new EncryptionUtilities();
                    if (txtemail.Text.Contains(">") || txtemail.Text.Contains("<") || txtemail.Text.Contains("'") || txtemail.Text.Contains("--") || txtemail.Text.Contains("%") || txtpassword.Text.Contains(">") || txtpassword.Text.Contains("<") || txtpassword.Text.Contains("'") || txtpassword.Text.Contains("--") || txtpassword.Text.Contains("%"))
                    {
                        txtpassword.Text = "";
                        txtemail.Text = "";
                        loginBox.Style.Add("display", "block");
                        trError.Visible = true;
                    }
                    else
                    {
                        string password = txtpassword.Text;
                        string userName = txtemail.Text;
                        string encrypwd = string.Empty;
                        string cid = canvBiz.GetCustId(userName.TrimStart(' ').TrimEnd(' '));
                        Dictionary<string, string> lgnDetails = canvBiz.DoLogin(userName.TrimStart(' ').TrimEnd(' '), password.TrimStart(' ').TrimEnd(' '));

                        if (!lgnDetails["pass"].ToString().Equals("ERROR") && !cid.ToString().Equals("ERROR"))
                        {
                            pwdencoded = lgnDetails["pass"].ToString();
                            encrypwd = _oEncryptionUtilities.getEncryptedCode(password);

                            if (pwdencoded.Equals(encrypwd))
                            {
                                //Login SUCCESS, Now get customer details and assign to Session
                                SessionData.Customer = new AppCustomer();
                                SessionData.Customer = canvBiz.GetCustomerInfo(userName, cid, true);

                                if ((Request.QueryString["fp"] != null && !string.IsNullOrEmpty(Request["id"])) ||
                                   (Request.QueryString["nu"] != null && !string.IsNullOrEmpty(Request["id"])))
                                {
                                    if (Request.QueryString["fp"] != null)
                                    {
                                        if (Request.QueryString["fp"].Contains("1") && Request.QueryString["id"] != null)
                                        {

                                        }
                                    }
                                    else

                                        if (Request.QueryString["nu"].Contains("1") && Request.QueryString["id"] != null)
                                        {

                                        }
                                        else
                                        {

                                        }

                                }
                                else
                                {
                                    //Login is a SUCCESS so Enable content DIV

                                    //*******************Now remove Login button, Add LOGOUT, WELCOME*******************

                                    //lblLoginuser.Visible = false;
                                    Response.Redirect("LandingPage.aspx?CDID=" + SessionData.Customer.CustomerID, false);
                                }
                            }
                            else
                            {
                                loginBox.Style.Add("display", "block");
                                trError.Visible = true;
                            }
                        }
                        else
                        {
                            loginBox.Style.Add("display", "block");
                            trError.Visible = true;
                            if ((txtemail.Text == string.Empty) && (txtpassword.Text == string.Empty))
                            {
                                lblError.Text = "Please provide both Username and Password to login";
                            }
                        }
                    }
                }
                else
                {
                    Response.Redirect("home.aspx");
                }
            }

            catch (Exception ex)
            {
                //objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);

            }
        }
示例#2
0
        protected void submibmail_Click(object sender, EventArgs e)
        {
            canvBiz = new CanvasBizProcess();
            AppCustomer oAppCustomer = new AppCustomer();

            string uid = canvBiz.GetCustId(txtmailid.Text.TrimStart(' ').TrimEnd(' '));
            try
            {
                if (txtmailid.Text.Contains(">") || txtmailid.Text.Contains("<") || txtmailid.Text.Contains("'") || txtmailid.Text.Contains("--") || txtmailid.Text.Contains("%"))
                {
                    txtmailid.Text = "";
                }
                else
                {
                    if (flag)
                    {
                        string NewTempPass = GenerateNewPassword(8);
                        string temppass = _oEncryptionUtilities.getEncryptedCode(NewTempPass);
                        int chkavalible = canvBiz.VerifyEmailInsertNewPassword(txtmailid.Text.TrimStart(' ').TrimEnd(' '), temppass);

                        if (chkavalible == 1)
                        {
                            int mailstatus = MailTrigger(txtmailid.Text);
                            if (mailstatus == 1)
                            {
                                string script = "alert('Password Sent To Email.');" + "location.href='Home.aspx?';";
                                this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true);
                                CanvasBizProcess canvasBiz = new CanvasBizProcess();
                                //UPdate fpStatus to 1 as user has requested reset password
                                canvasBiz.UpdatefpStatus(uid, 1);
                                //canvBiz.UpdateTempPwd(txtmailid.Text, temppass);

                            }
                        }
                        else
                        {
                            maillbl.Visible = true;
                            maillbl.Text = " Invalid Email Id /Please Check Email Id Again.";
                            CodeNumberTextBox.Text = "";
                            this.Session["CaptchaImageText"] = GenerateRandomCode();
                            errorlblsecurity.Text = string.Empty;
                        }
                    }
                    else
                    {
                        errorlblsecurity.Style.Add("display", "block");
                        errorlblsecurity.Text = "The Characters Doesn't Match. Please Try Again.";
                        CodeNumberTextBox.Text = "";
                        errorlblsecurity.Focus();
                    }

                }
            }

            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
        }
示例#3
0
        private int MailTrigger(string txtEmailid)
        {
            try
            {
                canvBiz = new CanvasBizProcess();
                string uid = canvBiz.GetCustId(txtEmailid);
                AppCustomer oAppCustomer = new AppCustomer();
                oAppCustomer = canvBiz.GetCustomerInfo(txtEmailid, uid, false);
                MailMessage mail = new MailMessage();
                //string adminid = txtmailid;
                string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"];
                string admpass = "******";// ConfigurationManager.AppSettings["userpassword"];
                System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass);
                mail.From = new MailAddress(adminid);//TODO: Put actual sender email address
                mail.To.Add(new MailAddress(txtEmailid));
                mail.Subject = "Welcome to SonetReach!";    // Mail Subject
                mail.IsBodyHtml = true;
                mail.Priority = MailPriority.High; //Mail Priority

                StringBuilder strBody = new StringBuilder();

                strBody.Append("<div><center><table border=\"2px black\" width=\"800px\" style=\"height:200px;\">");
                strBody.Append("<tr><td style=\"background-color: #8BCD98; height: 40px; width: 400px;\">");
                strBody.Append("<center><span style=\"color: #0D6DA0; font-family: Verdana; font-size: large;\">");
                strBody.Append("SONETREACH");
                strBody.Append("</span></center></td></tr><tr><td>");
                strBody.Append("<span style=\"font-family: Verdana;\">");
                strBody.Append("<br/>");
                strBody.Append("Hello");
                strBody.Append("<br>");
                strBody.Append("<br>");
                strBody.Append("Thank you for registering with SONETREACH .To complete registration, Please follow this link.<br /><br/>");

                strBody.Append("https://www.testsonetreach.com/Confirmation.aspx?nu=1&id=" + HttpUtility.UrlEncode(CommonUtility.Encrypt(uid)) + "");
                strBody.Append("<br><br>");
                strBody.Append("User Name: &nbsp;");
                strBody.Append(txtEmailid);
                strBody.Append("<br><br><br>");
                strBody.Append("Thanks,");
                strBody.Append("<br><br>");
                strBody.Append("DigiMa Team");
                strBody.Append("</span></td></tr></tr></table></center></div>");

                mail.Body = strBody.ToString();
                SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25);
                mSMTPClient.EnableSsl = false;
                mSMTPClient.UseDefaultCredentials = true;
                mSMTPClient.Credentials = auth;
                mSMTPClient.Port = 25; // PORT NUMBER
                mSMTPClient.Host = "smtpauth.net4india.com";
                mSMTPClient.Send(mail);
                return 1;
            }
            catch (Exception ex)
            {
                objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
            return 0; //for failure if try is not executed
        }
示例#4
0
        private int MailTriggerToSonetREachAdmin(string txtEmailid)
        {
            try
            {
                canvBiz = new CanvasBizProcess();
                string uid = canvBiz.GetCustId(txtEmailid);
                AppCustomer oAppCustomer = new AppCustomer();
                oAppCustomer = canvBiz.GetCustomerInfo(txtEmailid, uid, false);
                MailMessage mail = new MailMessage();
                //string adminid = txtmailid;
                string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"];
                string admpass = "******";// ConfigurationManager.AppSettings["userpassword"];
                System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass);
                mail.From = new MailAddress(adminid);//TODO: Put actual sender email address
                mail.To.Add(new MailAddress("*****@*****.**"));
                mail.Subject = "New Registration"; // Mail Subject
                mail.IsBodyHtml = true;
                mail.Priority = MailPriority.High; //Mail Priority

                mail.Body = txtEmailid + " has just registered with SonetReach !";
                SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25);
                mSMTPClient.EnableSsl = false;
                mSMTPClient.UseDefaultCredentials = true;
                mSMTPClient.Credentials = auth;
                mSMTPClient.Port = 25; // PORT NUMBER
                mSMTPClient.Host = "smtpauth.net4india.com";
                mSMTPClient.Send(mail);
                return 1;
            }
            catch (Exception ex)
            {
                objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
            return 0; //for failure if try is not executed
        }