/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <history> /// [cnurse] 9/8/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Load(Object sender, EventArgs e) { // Verify if portal has a customized login page if (!Null.IsNull(PortalSettings.LoginTabId) && Globals.IsAdminControl()) { // login page exists and trying to access this control directly with url param -> not allowed Response.Redirect(Globals.NavigateURL(PortalSettings.LoginTabId)); } ClientAPI.RegisterKeyCapture(this.Parent, this.cmdLogin, '\r'); if (Request.UserHostAddress != null) { ipAddress = Request.UserHostAddress; } if (Page.IsPostBack == false) { try { if (Request.QueryString["verificationcode"] != null) { if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { //Display Verification Rows rowVerification1.Visible = true; rowVerification2.Visible = true; txtVerification.Text = Request.QueryString["verificationcode"]; } } PageNo = 0; if (Request.QueryString["username"] != null) { txtUsername.Text = Request.QueryString["username"]; Globals.SetFormFocus(txtPassword); } else { Globals.SetFormFocus(txtUsername); } } catch { //control not there or error setting focus } } ShowPanel(); }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/8/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdLogin.Click += OnLoginClick; ClientAPI.RegisterKeyCapture(Parent, cmdLogin, 13); if (!Request.IsAuthenticated) { if (Page.IsPostBack == false) { try { if (Request.QueryString["username"] != null) { txtUsername.Text = Request.QueryString["username"]; } if (Request.QueryString["verificationcode"] != null) { if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { //Display Verification Rows divVerify.Visible = true; txtVerification.Text = Request.QueryString["verificationcode"]; } } } catch (Exception ex) { //control not there DnnLog.Error(ex); } } try { Globals.SetFormFocus(string.IsNullOrEmpty(txtUsername.Text) ? txtUsername : txtPassword); } catch (Exception ex) { //Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following //control not there or error setting focus DnnLog.Error(ex); } } divCaptcha1.Visible = UseCaptcha; divCaptcha2.Visible = UseCaptcha; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdLogin.Click += OnLoginClick; ClientAPI.RegisterKeyCapture(Parent, cmdLogin, 13); if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration) { liRegister.Visible = false; } lblLogin.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_LOGIN_INSTRUCTIONS"); var returnUrl = Globals.NavigateURL(); string url; if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration) { if (!string.IsNullOrEmpty(Request.QueryString["returnurl"])) { returnUrl = Request.QueryString["returnurl"]; } returnUrl = HttpUtility.UrlEncode(returnUrl); url = Globals.RegisterURL(returnUrl, Null.NullString); registerLink.NavigateUrl = url; if (PortalSettings.EnablePopUps && PortalSettings.RegisterTabId == Null.NullInteger && !HasSocialAuthenticationEnabled()) { registerLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 600, 950)); } } else { registerLink.Visible = false; } //see if the portal supports persistant cookies chkCookie.Visible = Host.RememberCheckbox; url = Globals.NavigateURL("SendPassword", "returnurl=" + returnUrl); passwordLink.NavigateUrl = url; if (PortalSettings.EnablePopUps) { passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650)); } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["verificationcode"]) && PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { if (Request.IsAuthenticated) { Controls.Clear(); } var verificationCode = Request.QueryString["verificationcode"]; try { UserController.VerifyUser(verificationCode.Replace(".", "+").Replace("-", "/").Replace("_", "=")); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("VerificationSuccess", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess); } catch (UserAlreadyVerifiedException) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserAlreadyVerified", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); } catch (InvalidVerificationCodeException) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } catch (UserDoesNotExistException) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserDoesNotExist", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } catch (Exception) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } } if (!Request.IsAuthenticated) { if (Page.IsPostBack == false) { try { if (Request.QueryString["username"] != null) { txtUsername.Text = Request.QueryString["username"]; } } catch (Exception ex) { //control not there Logger.Error(ex); } } try { Globals.SetFormFocus(string.IsNullOrEmpty(txtUsername.Text) ? txtUsername : txtPassword); } catch (Exception ex) { //Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following //control not there or error setting focus Logger.Error(ex); } } var registrationType = PortalController.GetPortalSettingAsInteger("Registration_RegistrationFormType", PortalId, 0); bool useEmailAsUserName; if (registrationType == 0) { useEmailAsUserName = PortalController.GetPortalSettingAsBoolean("Registration_UseEmailAsUserName", PortalId, false); } else { var registrationFields = PortalController.GetPortalSetting("Registration_RegistrationFields", PortalId, String.Empty); useEmailAsUserName = !registrationFields.Contains("Username"); } plUsername.Text = LocalizeString(useEmailAsUserName ? "Email" : "Username"); divCaptcha1.Visible = UseCaptcha; divCaptcha2.Visible = UseCaptcha; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdLogin.Click += OnLoginClick; cmdCancel.Click += OnCancelClick; ClientAPI.RegisterKeyCapture(Parent, cmdLogin, 13); if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration) { liRegister.Visible = false; } lblLogin.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_LOGIN_INSTRUCTIONS"); if (!string.IsNullOrEmpty(Response.Cookies["USERNAME_CHANGED"].Value)) { txtUsername.Text = Response.Cookies["USERNAME_CHANGED"].Value; DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetSystemMessage(PortalSettings, "MESSAGE_USERNAME_CHANGED_INSTRUCTIONS"), ModuleMessage.ModuleMessageType.BlueInfo); } var returnUrl = Globals.NavigateURL(); string url; if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration) { if (!string.IsNullOrEmpty(UrlUtils.ValidReturnUrl(Request.QueryString["returnurl"]))) { returnUrl = Request.QueryString["returnurl"]; } returnUrl = HttpUtility.UrlEncode(returnUrl); url = Globals.RegisterURL(returnUrl, Null.NullString); registerLink.NavigateUrl = url; if (PortalSettings.EnablePopUps && PortalSettings.RegisterTabId == Null.NullInteger && !HasSocialAuthenticationEnabled()) { registerLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 600, 950)); } } else { registerLink.Visible = false; } //see if the portal supports persistant cookies chkCookie.Visible = Host.RememberCheckbox; // no need to show password link if feature is disabled, let's check this first if (MembershipProviderConfig.PasswordRetrievalEnabled || MembershipProviderConfig.PasswordResetEnabled) { url = Globals.NavigateURL("SendPassword", "returnurl=" + returnUrl); passwordLink.NavigateUrl = url; if (PortalSettings.EnablePopUps) { passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650)); } } else { passwordLink.Visible = false; } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["verificationcode"]) && PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration) { if (Request.IsAuthenticated) { Controls.Clear(); } var verificationCode = Request.QueryString["verificationcode"]; try { UserController.VerifyUser(verificationCode.Replace(".", "+").Replace("-", "/").Replace("_", "=")); var redirectTabId = PortalSettings.Registration.RedirectAfterRegistration; if (Request.IsAuthenticated) { Response.Redirect(Globals.NavigateURL(redirectTabId > 0 ? redirectTabId : PortalSettings.HomeTabId, string.Empty, "VerificationSuccess=true"), true); } else { if (redirectTabId > 0) { var redirectUrl = Globals.NavigateURL(redirectTabId, string.Empty, "VerificationSuccess=true"); redirectUrl = redirectUrl.Replace(Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias), string.Empty); Response.Cookies.Add(new HttpCookie("returnurl", redirectUrl) { Path = (!string.IsNullOrEmpty(Globals.ApplicationPath) ? Globals.ApplicationPath : "/") }); } UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("VerificationSuccess", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess); } } catch (UserAlreadyVerifiedException) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserAlreadyVerified", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); } catch (InvalidVerificationCodeException) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } catch (UserDoesNotExistException) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserDoesNotExist", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } catch (Exception) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } } if (!Request.IsAuthenticated) { if (!Page.IsPostBack) { try { if (Request.QueryString["username"] != null) { txtUsername.Text = Request.QueryString["username"]; } } catch (Exception ex) { //control not there Logger.Error(ex); } } try { Globals.SetFormFocus(string.IsNullOrEmpty(txtUsername.Text) ? txtUsername : txtPassword); } catch (Exception ex) { //Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following //control not there or error setting focus Logger.Error(ex); } } var registrationType = PortalSettings.Registration.RegistrationFormType; bool useEmailAsUserName; if (registrationType == 0) { useEmailAsUserName = PortalSettings.Registration.UseEmailAsUserName; } else { var registrationFields = PortalSettings.Registration.RegistrationFields; useEmailAsUserName = !registrationFields.Contains("Username"); } plUsername.Text = LocalizeString(useEmailAsUserName ? "Email" : "Username"); divCaptcha1.Visible = UseCaptcha; divCaptcha2.Visible = UseCaptcha; }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <history> /// [cnurse] 9/13/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Load(Object sender, EventArgs e) { try { // Verify if portal has a customized registration page if (!Null.IsNull(PortalSettings.UserTabId) && Globals.IsAdminControl()) { // user page exists and trying to access this control directly with url param -> not allowed Response.Redirect(Globals.NavigateURL(PortalSettings.UserTabId)); } // Verify that the current user has access to this page if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration && Request.IsAuthenticated == false) { Response.Redirect(Globals.NavigateURL("Access Denied"), true); } if ((Request.QueryString["Services"] != null)) { Services = int.Parse(Request.QueryString["Services"]); } // free subscriptions if ((Request.QueryString["RoleID"] != null)) { RoleID = int.Parse(Request.QueryString["RoleID"]); RoleController objRoles = new RoleController(); RoleInfo objRole = objRoles.GetRole(RoleID, PortalSettings.PortalId); if (objRole.IsPublic && objRole.ServiceFee == 0.0) { objRoles.UpdateUserRole(PortalId, UserInfo.UserID, RoleID, Convert.ToBoolean((Request.QueryString["cancel"] != null) ? true : false)); if (PortalSettings.UserTabId != -1) { // user defined tab Response.Redirect(Globals.NavigateURL(PortalSettings.UserTabId), true); } else { // admin tab Response.Redirect(Globals.NavigateURL("Register"), true); } } else { // EVENTLOGGER } } // If this is the first visit to the page, bind the role data to the datalist if (Page.IsPostBack == false) { //Localize the Headers Localization.LocalizeDataGrid(ref grdServices, this.LocalResourceFile); ClientAPI.AddButtonConfirm(cmdUnregister, Localization.GetString("CancelConfirm", this.LocalResourceFile)); BindData(); try { Globals.SetFormFocus(userControl); } catch { //control not there or error setting focus } // Store URL Referrer to return to portal if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer); } else { ViewState["UrlReferrer"] = ""; } } lblRegistration.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_REGISTRATION_INSTRUCTIONS"); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }