Exemplo n.º 1
0
        private bool IsAValidKey(string key)
        {
            bool retVal = !string.IsNullOrEmpty(key);
            if (retVal) {

                RequestTable table = new RequestTable();

                table.ExpireOldRequests();

                int nUserID = table.GetValidRequest(key);

                retVal = (nUserID >= 0);

                if (retVal) {
                    UsersDB db = new UsersDB();

                    db.MarkUserEmailVerifyied(nUserID);
                }

            }
            return retVal;
        }
Exemplo n.º 2
0
        private bool IsAValidKey(string key)
        {
            bool retVal = !string.IsNullOrEmpty(key);

            if (retVal)
            {
                RequestTable table = new RequestTable();

                table.ExpireOldRequests();

                int nUserID = table.GetValidRequest(key);

                retVal = (nUserID >= 0);

                if (retVal)
                {
                    UsersDB db = new UsersDB();

                    db.MarkUserEmailVerifyied(nUserID);
                }
            }
            return(retVal);
        }
        protected void sendEmail(int nUserID, string strEmail, string strToken, FileListDetails fld)
        {
            //Response.Write("UserID= " + nUserID + "<br>Email= " + strEmail + "<br>Token= " + strToken);

            RequestTable table = new RequestTable();

            table.InsertRequest(new RequestDetails(nUserID, strToken));

            string strURL = ResolveServerUrl("/download",false);

            string strLogoURL = ResolveServerUrl("/Images/Pitt-Logo.gif", false);

            string strDownloadLink = strURL + "?&file=" + fld.FileName +  "&id=" + strToken;

            string strMsg = "<body> <img src=\"" + strLogoURL + "\" /> <br> We have recieved your request to download our software package. " +
            "The following is a link containing the software you requested: <br>" + strDownloadLink + " </body>";

            MailMessage msgeme = new MailMessage("*****@*****.**", strEmail, "My Statistics Software Download Link", strMsg);
            msgeme.IsBodyHtml = true;

            //SmtpClient smtpclient = new SmtpClient("in.mailjet.com", 587);
            SmtpClient smtpclient = new SmtpClient("smtp.pitt.edu",25);
            smtpclient.UseDefaultCredentials = false;
            smtpclient.EnableSsl = true;
            //smtpclient.Credentials = new NetworkCredential("rocmail", "##password");
            smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;

            //smtpclient.Port = 587;
            //smtpclient.Host = "smtp.pitt.edu";

            smtpclient.Send(msgeme);

            //try
            //{
            //    smtpclient.Send(msgeme);
            //}
            //catch (Exception ex)
            //{

            //    String message = ex.Message;

            //    Response.Write("<script language='javascript'>alert('" +
            //        Server.HtmlEncode(message) + "')</script>");
            //}

            // Now we should check if the email address has been verified and if so redirect to that instead of the Email Sent page.

            var response = base.Response;

            if (!db.HasUserVerifiedEmail(nUserID))
            {
                response.Redirect("./DownloadEmailSent.aspx");
            }
            else
            {
                response.Redirect(strDownloadLink);
            }
        }
Exemplo n.º 4
0
        protected void sendEmail(int nUserID, string strEmail, string strToken, FileListDetails fld)
        {
            //Response.Write("UserID= " + nUserID + "<br>Email= " + strEmail + "<br>Token= " + strToken);

            RequestTable table = new RequestTable();

            table.InsertRequest(new RequestDetails(nUserID, strToken));

            string strURL = ResolveServerUrl("/download", false);

            string strLogoURL = ResolveServerUrl("/Images/Pitt-Logo.gif", false);

            string strDownloadLink = strURL + "?&file=" + fld.FileName + "&id=" + strToken;

            string strMsg = "<body> <img src=\"" + strLogoURL + "\" /> <br> We have recieved your request to download our software package. " +
                            "The following is a link containing the software you requested: <br>" + strDownloadLink + " </body>";

            MailMessage msgeme = new MailMessage("*****@*****.**", strEmail, "My Statistics Software Download Link", strMsg);

            msgeme.IsBodyHtml = true;

            //SmtpClient smtpclient = new SmtpClient("in.mailjet.com", 587);
            SmtpClient smtpclient = new SmtpClient("smtp.pitt.edu", 25);

            smtpclient.UseDefaultCredentials = false;
            smtpclient.EnableSsl             = true;
            //smtpclient.Credentials = new NetworkCredential("rocmail", "##password");
            smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;

            //smtpclient.Port = 587;
            //smtpclient.Host = "smtp.pitt.edu";

            smtpclient.Send(msgeme);

            //try
            //{
            //    smtpclient.Send(msgeme);
            //}
            //catch (Exception ex)
            //{


            //    String message = ex.Message;

            //    Response.Write("<script language='javascript'>alert('" +
            //        Server.HtmlEncode(message) + "')</script>");
            //}


            // Now we should check if the email address has been verified and if so redirect to that instead of the Email Sent page.

            var response = base.Response;

            if (!db.HasUserVerifiedEmail(nUserID))
            {
                response.Redirect("./DownloadEmailSent.aspx");
            }
            else
            {
                response.Redirect(strDownloadLink);
            }
        }