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; } }
protected void btnLogin_Click(object sender, EventArgs e) { try { string strURL = ""; string strUID = txtLoginName.Text.Trim(); string strPwd = txtPassword.Text.Trim(); lblError.ForeColor = System.Drawing.Color.Black; DataTable dtResults = DataProxy.GetUserInfo(strUID, strPwd); if (dtResults != null) { if (dtResults.Rows.Count > 0) { if (DataProxy.CheckUserApproved(strUID)) { Session["UserName"] = strUID; //Figure out where they should go? Main dashboard? if (strSpeciesID != "") { //User was brought in here by Search Results and tried to add a new assessment... strURL = "CreateAssessment.aspx?SpeciesID=" + strSpeciesID + "&CountryID=" + strCountryID; } else { //Check user's role and redirect to appropriate dashboard... string strUserRole = DataProxy.GetUserType(strUID); Session["UserRole"] = strUserRole; if (strUserRole.ToUpper() == "ASSESSOR") { strURL = "AssessorDashboard.aspx?UID=" + strUID; } else { if (strUserRole.ToUpper() == "GUEST") { strURL = "Default.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) { //Session["UserName"] = null; lblError.Text = ex.Message; } }