More in this section

Forums / Developing with Sitefinity / Create User link on LoginForm

Create User link on LoginForm

2 posts, 1 answered
  1. Joel
    Joel avatar
    40 posts
    Registered:
    30 Nov 2010
    06 Dec 2012
    Link to this post
    Hey all, 

    I need to run code when a user is logged in so I've got a user control that instanciates a new LoginControl and adds a handler for when a user is logged in.

    private LoginControl CreatedOverloadedLoginControl() {
        LoginControl oscpaLoginControl;
        oscpaLoginControl = new LoginControl();
     
        // expose the membership provider property
        if (!string.IsNullOrEmpty(this.MembershipProvider)) {
            oscpaLoginControl.MembershipProvider = MembershipProvider;
        }
     
        if (!DisableAptifyLogin) {
            oscpaLoginControl.LoggedIn += oscpaLoginControl_LoggedIn;
        }
        oscpaLoginControl.PreRender += oscpaLoginControl_PreRender;
        return oscpaLoginControl;
    }

    I've tried to modify the "oscpaLoginControl.CreateUserUrl" in every event in the user control's life cycle.  Each time I make a change to it, it reverts to "javascript(0);".

    void oscpaLoginControl_PreRender(object sender, EventArgs e) {
        var oscpaLoginControl = (LoginControl)sender;
     
        oscpaLoginControl.PasswordRecoveryText += "<br />";
        oscpaLoginControl.PasswordChangeText += "<br />";
        oscpaLoginControl.CreateUserText += "<br />";
        if (!string.IsNullOrEmpty(CreateUserUrl) && !string.IsNullOrEmpty(CreateUserText)) {
            oscpaLoginControl.CreateUserText = CreateUserText;
            oscpaLoginControl.CreateUserUrl = CreateUserUrl;
            oscpaLoginControl.ShowRegisterUserLink = true;
        }
        // expose the css class and add the new login control to our login
        oscpaLoginControl.CssClass = TopLevelElementCSSClass;
    }

    How should I be modifying the LoginControl's CreateUserUrl Property? Is there a system setting that I'm not aware of?

    Thank you!
    Joel
  2. Joel
    Joel avatar
    40 posts
    Registered:
    30 Nov 2010
    06 Dec 2012
    Link to this post
    After hours of testing, I found my issue.

    I had to "Enable" SMTP messages from my website.

    From Admistration, click "Settings", and "Advanced". 
    Under System -> SMTP (Email Settings) add a mail server.
    (under the covers, it adds a row to your SystemConfig.config)
    ...
    <
    add title="Articles" moduleId="00000000-0000-0000-0000-000000000000" type="Articles.ArticlesModule" startupType="OnApplicationStart" version="1.0.0.0" name="Articles" />
        </applicationModules>
        <smtpSettings host="mail.xxxxx.net" />
        <typeImplementationsMapping>
            <add type="Telerik.Sitefinity.Web.UI.ContentUI.Config.ContentViewDefinitionElement">
                <implementations>
                    <add type="Telerik.Sitefinity.Forums.Web.Config.ThreadsViewMasterElement" />
                    <add type="Telerik.Sitefinity.Forums.Web.Config.ForumsViewMasterElement" />
                </implementations>
    ...

    Then add the <system.net>.. mail config to your web.config (if you're managing at a higher level than individual website web.configs, then you may have to go to Machine.config or whatever level you manage at).
    ...
          <issuerTokenResolver type="Telerik.Sitefinity.Security.Claims.SWT.WrapIssuerTokenResolver, Telerik.Sitefinity"/>
        </service>
      </microsoft.identityModel>
      <system.net>
        <mailSettings>
          <smtp>
            <network host="mail.xxxxx.net" />
          </smtp>
        </mailSettings>
      </system.net>
      <!-- Begin telerik section  -->
      <!--<telerik>
        <sitefinity>
          <environment platform="WindowsAzure"/>
          <sitefinityConfig storageMode="Database" />
        </sitefinity>
      </telerik>-->
      <!-- End telerik section  -->
    </configuration>

    Then, you will be able to modify those properties without them reverting to "javascript(0);". 
    Answered
2 posts, 1 answered