Ejemplo n.º 1
0
        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            try
            {
                string strURL = "";
                string strUID = txtLogin.Text.Trim();
                string strPwd = txtPassword.Text.Trim();
                lblError.ForeColor = System.Drawing.Color.Black;

                string strUser = DataProxy.FindUser(strUID);

                if (strUser != "")
                {
                    string s = DataProxy.UpdateUserPassword(strUID, strPwd);

                    if (DataProxy.CheckUserApproved(strUID))
                    {
                        Session["UserName"] = strUID;
                        //Figure out where they should go? Main dashboard?

                        //Check user's role and redirect to appropriate dashboard...
                        string strUserRole = DataProxy.GetUserType(strUID);

                        if (strUserRole.ToUpper() == "ASSESSOR")
                        {
                            strURL = "AssessorDashboard.aspx?UID=" + strUID;
                        }
                        else
                        {
                            if (strUserRole.ToUpper() == "FACILITATOR")
                            {
                                strURL = "FacilitatorDashboard.aspx?UID=" + strUID;
                            }
                            else
                            {
                                strURL = "AdminDashboard.aspx?UID=" + strUID;
                            }
                        }
                        Response.Redirect(strURL);
                    }
                    else
                    {
                        lblError.ForeColor = System.Drawing.Color.Red;
                        lblError.Text      = DataProxy.LoadString("NOTAPPROVEDTEXT", strCurrentLanguage);
                    }
                }
                else
                {
                    lblError.ForeColor = System.Drawing.Color.Red;
                    lblError.Text      = DataProxy.LoadString("INVALIDLOGINERRORTEXT", strCurrentLanguage);
                }
            }

            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }