Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["email"] != null)
     {
         Response.Redirect("HomePage.aspx");
     }
     if (Request.Form["submit"] != null)
     {
         string email = Request.Form["email"];
         if (MyADOHelper.Exist(email))
         {
             ClientScript.RegisterStartupScript(GetType(), "Verifyaspx", "aspxVerification(true);", true);
         }
         else
         {
             MyADOHelper.Insert(email, Request.Form["reguser"], Request.Form["finame"], Request.Form["laname"], Request.Form["passmake"], int.Parse(Request.Form["gender"]), Request.Form["bdate"], Request.Form["country"], char.Parse(Request.Form["securequest"]), Request.Form["secureans"]);
             if (MyADOHelper.errorMessage != null)
             {
                 Response.Write(MyADOHelper.errorMessage);
                 MyADOHelper.errorMessage = null;
             }
             else
             {
                 Response.Redirect("SignIn.aspx");
             }
         }
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((int)Session["fails"] >= 3)
     {
         Response.Redirect("ForgotPass.aspx");
     }
     else if (Session["email"] != null)
     {
         Response.Redirect("HomePage.aspx");
     }
     else if (Request.Form["submit"] != null)
     {
         if (MyADOHelper.Authentication(Request.Form["email"], Request.Form["password"]))
         {
             ClientScript.RegisterStartupScript(GetType(), "Login Error", "loginVerification(true);", true);
             Session["email"]    = Request.Form["email"];
             Session["isAdmin"]  = MyADOHelper.ShowIsAdmin(Session["email"].ToString());
             Session["username"] = MyADOHelper.Select(Session["email"].ToString(), "username");
             Response.Redirect("HomePage.aspx");
         }
         else
         {
             Session["fails"] = (int)Session["fails"] + 1;
             ClientScript.RegisterStartupScript(GetType(), "Login Error", "loginVerification(false);", true);
         }
     }
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["email"] != null)
            {
                Response.Redirect("HomePage.aspx");
            }
            Random rnd = new Random();

            if (Request.Form["submit"] != null)
            {
                if (MyADOHelper.Exist(Request.Form["email"]))
                {
                    ClientScript.RegisterStartupScript(GetType(), "Send Mail Message", "sendMailMessage(true);", true);
                    Session["v"] = rnd.Next(99999999);
                    Session["changePassEmail"] = Request.Form["email"];
                    MailMessage mail = new MailMessage();
                    mail.To.Add(Request.Form["email"]);
                    mail.From       = new MailAddress("*****@*****.**");
                    mail.Subject    = "INCloud Password Change";
                    mail.Body       = "Click this link to change your password: \n http://localhost:57646/Pages/ChangePass.aspx?v=" + (int)Session["v"] + "&m=" + Request.Form["email"];
                    mail.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
                    smtp.EnableSsl             = true;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "itay2003");
                    smtp.Send(mail);
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "Send Mail Message", "sendMailMessage(false);", true);
                }
            }
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["email"] == null || !(bool)Session["isAdmin"])
     {
         Response.Redirect("HomePage.aspx");
     }
     if (Request.Form["update"] != null)
     {
         for (int i = 0; Request.Form["" + i] != null; i++)
         {
             if (Request.Form["" + i].ToString()[0] == '@')
             {
                 MyADOHelper.Update(Request.Form["" + i].ToString().Remove(0, 1), "isAdmin", false);
             }
             else
             {
                 MyADOHelper.Update(Request.Form["" + i].ToString().Remove(Request.Form["" + i].ToString().LastIndexOf(',')), "isAdmin", true);
             }
         }
         for (int i = 0; Request.Form["o" + i] != null; i++)
         {
             if (Request.Form["o" + i] != null)
             {
                 //Remove user's files and then user's details
                 using (SqlConnection cn = new SqlConnection(gone))
                 {
                     SqlCommand cmd = new SqlCommand("removeUser", cn);
                     cmd.CommandType = CommandType.StoredProcedure;
                     cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = Request.Form["o" + i].ToString();
                     cn.Open();
                     cmd.ExecuteNonQuery();
                     cn.Close();
                 }
                 MyADOHelper.Delete(Request.Form["o" + i].ToString());
                 if (Session["email"].ToString() == Request.Form["o" + i].ToString())
                 {
                     Session.Abandon();
                 }
             }
         }
     }
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["email"] == null)
     {
         Response.Redirect("HomePage.aspx");
     }
     else if (Request.Form["submit"] != null)
     {
         MyADOHelper.Update(Session["email"].ToString(), "username", Request.Form["username"]);
         MyADOHelper.Update(Session["email"].ToString(), "firstname", Request.Form["finame"]);
         MyADOHelper.Update(Session["email"].ToString(), "lastname", Request.Form["laname"]);
         MyADOHelper.Update(Session["email"].ToString(), "password", Request.Form["passmake"]);
         MyADOHelper.Update(Session["email"].ToString(), "bdate", Request.Form["bdate"]);
         MyADOHelper.Update(Session["email"].ToString(), "country", Request.Form["country"]);
     }
     else
     {
         Session["username"] = MyADOHelper.Select(Session["email"].ToString(), "username");
         Session["finame"]   = MyADOHelper.Select(Session["email"].ToString(), "firstname");
         Session["laname"]   = MyADOHelper.Select(Session["email"].ToString(), "lastname");
         Session["password"] = MyADOHelper.Select(Session["email"].ToString(), "password");
         Session[MyADOHelper.Select(Session["email"].ToString(), "gender").ToString()] = "checked";
         Session["country"] = MyADOHelper.Select(Session["email"].ToString(), "country");
         string bdate = MyADOHelper.Select(Session["email"].ToString(), "bdate").ToString();
         bdate = bdate.Remove(bdate.LastIndexOf('/') + 5);
         string   newstr = "";
         string[] arr    = new string[3];
         arr = bdate.Split('/');
         for (int i = 0; i < arr.Length; i++)
         {
             if (arr[i].Length < 2)
             {
                 string num = arr[i];
                 arr[i] = "0" + num;
             }
         }
         newstr          += arr[2] + '-';
         newstr          += arr[1] + '-';
         newstr          += arr[0];
         Session["bdate"] = newstr;
     }
 }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["email"] != null)
            {
                Response.Redirect("HomePage.aspx");
            }
            if (Request.Form["submit"] != null)
            {
                if (MyADOHelper.IsRightAnswer(Session["changePassEmail"].ToString(), Request.Form["secureVeri"]))
                {
                    ClientScript.RegisterStartupScript(GetType(), "Security Error Message", "securityQuestVeri(true);", true);
                    MyADOHelper.Update(Session["changePassEmail"].ToString(), "password", Request.Form["passmake"]);
                    Session["fails"] = 0;
                    Response.Redirect("SignIn.aspx");
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "Security Error Message", "securityQuestVeri(false);", true);
                }
            }
            if (Request.QueryString["v"] != null && Request.QueryString["m"] != null && Session["v"] != null && Session["changePassEmail"] != null)
            {
                if (Session["changePassEmail"].ToString() == Request.QueryString["m"] && (int)Session["v"] == int.Parse(Request.QueryString["v"]))
                {
                    char securityQuestion = char.Parse((MyADOHelper.Select(Session["changePassEmail"].ToString(), "securequest").ToString()).Replace(" ", String.Empty));
                    switch (securityQuestion)
                    {
                    case 'p':
                        Session["secQuest"] = "What's your pet name?";
                        break;

                    case 'f':
                        Session["secQuest"] = "What's your best friend name?";
                        break;

                    case 'l':
                        Session["secQuest"] = "Where do you live?";
                        break;

                    case 'm':
                        Session["secQuest"] = "What's your mother's last name before she merried?";
                        break;

                    case 's':
                        Session["secQuest"] = "What's the name of the first school you were in?";
                        break;

                    default:
                        Session["secQuest"] = "wtf";
                        break;
                    }
                }
                else
                {
                    Response.Redirect("HomePage.aspx");
                }
            }
            else
            {
                Response.Redirect("HomePage.aspx");
            }
        }
Beispiel #7
0
 //Gets table's info
 protected static string GetChart(string email)
 {
     return(MyADOHelper.TableOfUsers(email));
 }