Ejemplo n.º 1
0
 protected void ForgetPassword(object sender, EventArgs e)
 {
     try
     {
         if (forget.Text == "OTP")
         {
             DataTable dt = new DataTable();
             objML_Login.ID      = txtUserName.Text != "" ? txtUserName.Text : null;
             objML_Login.EmailID = txtForgetEmail.Text != "" ? txtForgetEmail.Text : null;
             dt = objBL_Login.BL_ForgetOTP(objML_Login);
             if (dt.Rows.Count > 0)
             {
                 GenerateOTP();
                 objCommonClass.LoginOTPLayout(txtUserName.Text, lblOTP.Text, txtForgetEmail.Text);
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Please check you Email ID for OTP')", true);
                 OTPVerify.Visible = true;
                 forget.Text       = "Verify";
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Invalid Email ID')", true);
             }
         }
         else if (forget.Text == "Verify")
         {
             if (lblOTP.Text == txtOTP.Text)
             {
                 forgetpassword.Visible = true;
                 OTPVerify.Visible      = false;
                 forget.Text            = "Forget Password";
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('OTP not Match')", true);
             }
         }
         else
         {
             objML_Login.UserName = txtUserName.Text != "" ? txtUserName.Text : null;
             objML_Login.Password = objCommonClass.GetEncrptPassword(txtNewPwd.Text);
             objML_Login.CPwd     = objCommonClass.GetEncrptPassword(txtConformPwd.Text);
             int x = objBL_Login.BL_ChangePassword(objML_Login);
             if (x == 1)
             {
                 BackToLogin(sender, e);
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Password Change successfully')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('" + ex.Message.ToString() + "')", true);
     }
 }