public void changePassoword(object sender, EventArgs e) { SocioBoard.Domain.Admin admin = (SocioBoard.Domain.Admin)Session["AdminProfile"]; AdminRepository adminrepo = new AdminRepository(); if (txtPassword.Text != "" && txtConfirmPassword.Text != "") { if (txtPassword.Text == admin.Password) { adminrepo.ChangePwd(txtConfirmPassword.Text, admin.UserName); txtConfirmPassword.Text = string.Empty; txtPassword.Text = string.Empty; ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Password changed successfully');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Password');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Password should not be blank');", true); } }
protected void btnLogin_Click(object sender, EventArgs e) { try { SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml"); AdminRepository adminRepo = new AdminRepository(); SocioBoard.Domain.Admin admin = adminRepo.GetUserInfo(txtUserName.Text, txtPassword.Text); if (admin != null) { Session["AdminProfile"] = admin; Response.Redirect("Dashboard.aspx"); } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please enter correct Username and password!');", true); } } catch (Exception ex) { } }
public void changePassoword(object sender, EventArgs e) { if (txtPassword.Text != "" && txtConfirmPassword.Text != "") { if (txtPassword.Text == txtConfirmPassword.Text) { SocioBoard.Domain.Admin admin = (SocioBoard.Domain.Admin)Session["AdminProfile"]; AdminRepository adminrepo = new AdminRepository(); adminrepo.ChangePassword(txtPassword.Text, admin.Password,admin.UserName); txtConfirmPassword.Text = string.Empty; txtPassword.Text = string.Empty; } } }
protected void btnLogin_Click(object sender, EventArgs e) { try { SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml"); AdminRepository adminRepo = new AdminRepository(); SocioBoard.Domain.Admin admin = adminRepo.GetUserInfo(txtUserName.Text, txtPassword.Text); if (admin != null) { Session["AdminProfile"] = admin; Response.Redirect("Dashboard.aspx"); } } catch (Exception ex) { } }