protected void PasswordResetBtn_Click(object sender, EventArgs e)
 {
     if (reset_pwd.Text != "" && reset_confirm_pwd.Text != "")
     {
         if (reset_pwd.Text == reset_confirm_pwd.Text)
         {
             string pwd          = new Classes.MySecurity().EncryptMd5(reset_pwd.Text);
             int    affectedRows = new Models.Login(email).UpdatePassword(pwd);
             if (affectedRows != 0)
             {
                 new Models.Login(email).DeleteGuId();
                 Session["Request"] = "Password reset Successful, Please Login !!";
                 Session["Type"]    = "Success";
                 Response.Redirect("~/Login.aspx");
             }
             else
             {
                 check_pwd.Text = "Error !";
             }
         }
         else
         {
             check_pwd.Text = "Passwords not Match";
         }
     }
     else
     {
         check_pwd.Text = "Invalid Password";
     }
 }
Example #2
0
        protected void ResetPwdBtn_Click(object sender, EventArgs e)
        {
            if (login_email.Text == "")
            {
                check.Text = "Please Enter Email address";
            }
            else
            {
                string[] userDetails  = new Models.Login(login_email.Text).GetUserDetail();
                string   guId         = new Classes.MySecurity().GuIdCode();
                int      affectedRows = new Models.Login(login_email.Text).SetGuId(guId);
                string   url1         = "Login.aspx";
                string   url2         = "PasswordReset.aspx?email=" + login_email.Text + "&guId=" + guId;

                if (!ResetPassword(userDetails[0], login_email.Text, url1, url2, guId))
                {
                    ResetPwdBtn.Visible = true;
                }
                else
                {
                    LoginBtn.Visible     = true;
                    register_btn.Visible = false;
                }
            }
        }
Example #3
0
        protected void SigninBtn_Click(object sender, EventArgs e)
        {
            if (login_email.Text == "" || login_pwd.Text == "")
            {
                login_email.BorderColor = System.Drawing.Color.Red;
                login_pwd.BorderColor   = System.Drawing.Color.Red;
                check.Text = "Incorrect User Name or Password !";
            }
            else
            {
                string[] userDetails = new Models.Login(login_email.Text).GetUserDetail();
                string   pwd_entered = new Classes.MySecurity().EncryptMd5(login_pwd.Text);

                if (new Models.Login(login_email.Text).CheckEmailExists() != 0)
                {
                    if (pwd_entered == userDetails[1])
                    {
                        if (userDetails[3] == "Active")
                        {
                            if (CheckBox1.Checked)
                            {
                                Response.Cookies["UNAME"].Value   = login_email.Text;
                                Response.Cookies["PWD"].Value     = login_pwd.Text;
                                Response.Cookies["UNAME"].Expires = DateTime.Now.AddDays(7);
                                Response.Cookies["PWD"].Expires   = DateTime.Now.AddDays(7);
                            }
                            else
                            {
                                Response.Cookies["UNAME"].Expires = DateTime.Now.AddDays(-1);
                                Response.Cookies["PWD"].Expires   = DateTime.Now.AddDays(-1);
                            }
                            check.Text        = "Match";
                            Session["userId"] = userDetails[2];
                            Response.Redirect("~/Dashboard.aspx");
                        }
                        else
                        {
                            check.Text = "Please Confirm your Account," + "<br />" + "Click here to Resend Link ! ";
                            refresh_btn_image.Visible = true;
                        }
                    }
                    else
                    {
                        login_email.BorderColor = System.Drawing.Color.Red;
                        login_pwd.BorderColor   = System.Drawing.Color.Red;
                        check.Text        = "Wrong Password";
                        pwd_reset.Visible = true;
                    }
                }
                else
                {
                    check.Text = "Please Create an Account, Before Sign In !!";
                }
            }
        }
Example #4
0
        protected void RefreshBtn_Click(object sender, ImageClickEventArgs e)
        {
            string[] userDetails  = new Models.Login(login_email.Text).GetUserDetail();
            string   guId         = new Classes.MySecurity().GuIdCode();
            int      affectedRows = new Models.Login(login_email.Text).SetGuId(guId);
            string   url1         = "Login.aspx";
            string   url2         = "EmailConfirm.aspx?email=" + login_email.Text + "&guId=" + guId;

            if (new Classes.MyMail().SendActivationEmail(userDetails[0], login_email.Text, url1, url2))
            {
                Response.Write("<script LANGUAGE='JavaScript'>alert('Confirmation Email Successfully Send')</script>");
            }
            else
            {
                Response.Write("<script LANGUAGE='JavaScript'>alert('Error !!')</script>");
            }
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (r_form_first_name.Text != "" && r_form_NIC_number.Text != "" && r_form_last_name.Text != "" && r_form_address.Text != "" && r_form_email.Text != "" && r_form_contact_number.Text != "" && r_form_password.Text != "" && r_form_confirm_password.Text != "")
            {
                r_form_first_name.BorderColor     = Color.White;
                r_form_last_name.BorderColor      = Color.White;
                r_form_NIC_number.BorderColor     = Color.White;
                r_form_contact_number.BorderColor = Color.White;
                r_form_city.BorderColor           = Color.White;
                r_form_address.BorderColor        = Color.White;
                r_form_email.BorderColor          = Color.White;

                if (r_form_password.Text != r_form_confirm_password.Text)
                {
                    pwd_lable.Visible = true;
                    r_form_confirm_password.BorderColor = Color.Red;
                    r_form_password.BorderColor         = Color.Red;
                }
                else
                {
                    r_form_confirm_password.BorderColor = Color.White;
                    r_form_password.BorderColor         = Color.White;

                    string[] details = new string[9];
                    details[0] = r_form_first_name.Text;
                    details[1] = r_form_last_name.Text;
                    details[2] = r_form_address.Text;
                    details[3] = r_form_city.Text;
                    details[4] = r_form_NIC_number.Text;
                    details[5] = r_form_contact_number.Text;
                    details[6] = r_form_email.Text;
                    details[7] = new Classes.MySecurity().EncryptMd5(r_form_password.Text);
                    details[8] = title_dropdown.Text;

                    if (new Models.Login(r_form_email.Text).CheckEmailExists() != 0)
                    {
                        EmailCheck.Visible = true;
                        EmailCheck.Text    = "* This email address alrady exist";
                    }
                    else
                    {
                        if (new Models.Login(r_form_email.Text).RegisterUser(details))
                        {
                            string guId          = new Classes.MySecurity().GuIdCode();
                            int    affectedRows2 = new Models.Login(r_form_email.Text).SetGuId(guId);
                            string url1          = "Register.aspx";
                            string url2          = "EmailConfirm.aspx?email=" + r_form_email.Text + "&guId=" + guId;

                            if (new Classes.MyMail().SendActivationEmail(r_form_first_name.Text, r_form_email.Text, url1, url2))
                            {
                                Response.Write("<script LANGUAGE='JavaScript' >alert('Confirmation Email Successfully Send')</script>");
                                Response.Redirect("Login.aspx");
                            }
                            else
                            {
                                Response.Write("<script LANGUAGE='JavaScript'>alert('Error !!, Confirmation Email not send.')</script>");
                            }
                        }
                        else
                        {
                            Response.Write("<script LANGUAGE='JavaScript'>alert('Error !!, Please Register again.')</script>");
                            Response.Redirect("Register.aspx");
                        }
                    }
                }
            }
            else
            {
                pwd_lable.Visible = false;

                if (r_form_first_name.Text != "")
                {
                    r_form_first_name.BorderColor = Color.White;
                }
                else
                {
                    r_form_first_name.BorderColor = Color.Red;
                }

                if (r_form_last_name.Text != "")
                {
                    r_form_last_name.BorderColor = Color.White;
                }
                else
                {
                    r_form_last_name.BorderColor = Color.Red;
                }

                if (r_form_NIC_number.Text != "")
                {
                    r_form_NIC_number.BorderColor = Color.White;
                }
                else
                {
                    r_form_NIC_number.BorderColor = Color.Red;
                }

                if (r_form_address.Text != "")
                {
                    r_form_address.BorderColor = Color.White;
                }
                else
                {
                    r_form_address.BorderColor = Color.Red;
                }

                if (r_form_city.Text != "")
                {
                    r_form_city.BorderColor = Color.White;
                }
                else
                {
                    r_form_city.BorderColor = Color.Red;
                }

                if (r_form_email.Text != "")
                {
                    r_form_email.BorderColor = Color.White;
                }
                else
                {
                    r_form_email.BorderColor = Color.Red;
                }

                if (r_form_contact_number.Text != "")
                {
                    r_form_contact_number.BorderColor = Color.White;
                }
                else
                {
                    r_form_contact_number.BorderColor = Color.Red;
                }

                if (r_form_password.Text != "")
                {
                    r_form_password.BorderColor = Color.White;
                }
                else
                {
                    r_form_password.BorderColor = Color.Red;
                }
                if (r_form_password.Text != "")
                {
                    r_form_confirm_password.BorderColor = Color.White;
                }
                else
                {
                    r_form_confirm_password.BorderColor = Color.Red;
                }
            }
        }