Пример #1
0
        }         // Page_Load

        protected void LoginControl_Authenticate(object sender, AuthenticateEventArgs e)
        {
            var ra  = new ReportAuthentication(new SqlConnection());
            var log = new LegacyLog();

            bool authenticated = ra.IsValidPassword(LoginControl.UserName, LoginControl.Password);

            log.Debug("authenticated: {0}", authenticated);

            if (authenticated)
            {
                FormsAuthentication.RedirectFromLoginPage(LoginControl.UserName, LoginControl.RememberMeSet);
            }
        }         // LoginControl_Authenticate
Пример #2
0
        }         // btnShowChangePassword_Click

        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            var ra = new ReportAuthentication(new SqlConnection());

            divChangePassword.Visible = true;
            divLogin.Visible          = false;

            if (ra.UpdatePassword(txtUserName.Text, txtOldPassword.Text, txtNewPassword1.Text))
            {
                lblMessage.Text           = "Password changed";
                divChangePassword.Visible = false;
                divLogin.Visible          = true;
            }
            else
            {
                lblMessage.Text = "Error occured, password was not changed";
            }

            lblMessage.Visible = true;
        }         // btnChangePassword_Click