Customised Login Page

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/18/2008 5:12:11 AM
Gravatar
Total Posts 15

Customised Login Page

Hi Joe,

I'd like to customize the login page and add some theme-specific content (probably adding another panel into the right pane etc).  I've been trying to keep any updates I make specific to my own assemblies, and extending the base functionality in any controls etc.

I noticed that the central redirecttologinpage method will always send to secure/login.aspx (I was looking to see if this was configurable).  This means (I think) that I'd have to amend the 'standard' login page in order to achieve the varied content - unless the page were extended.  I guess I was hoping to be able to configure the login page location somewhere and create a page that extended the sitelogin control. I completely understand that this is a bit of a left field request, and don't expect it to be supported.

Any ideas how I could (cleanly) add some extra content to the login page without actually compromising the login.aspx itself?  Maybe I'm just trying too hard to keep the base installation intact!    I've always got one eye on keeping the upgrade path clear...

Cheers,

Matt

4/18/2008 8:37:04 AM
Gravatar
Total Posts 18439

Re: Customised Login Page

Hi Matt,

I'm going to be travelling today an mostly offline but I will look into this next week and see if I can make it configurable for you. I've been thinking of doing the same thing for the member list so that its easy to plug in a custom one as well.

Best,

Joe

4/29/2008 6:44:42 AM
Gravatar
Total Posts 18439

Re: Customised Login Page

Hi Matt,

I implemented support for this yesterday so if you have the latst svn trunk code you can test it.

You can set the custom login page in Web.config

<add key="LoginPageRelativeUrl" value="/Secure/Login.aspx" />

Let me know if it works as expected.

Best,

Joe

4/29/2008 7:30:09 AM
Gravatar
Total Posts 15

Re: Customised Login Page

Thanks a million Joe, 

Just updated so will give this a go tomorrow and let you know how I go. 

Cheers,

Matt

4/30/2008 7:25:06 AM
Gravatar
Total Posts 15

Re: Customised Login Page

Hi Joe,

Checked it all out (after realising I'd updated before you checked in!). 

I basically took a copy of the secure/login.aspx page and amended as I required.  This involved some content in the right pane.  The page showed up but the right pane didn't, so I had a look and found that there's some rules around pages where the menu doesn't show - e.g login.aspx etc. 

The logic (in Layout.Master.SetupLayout()) takes you down the path of expecting to find modules in the left or right pane in order to show them.  I've added static content as I effectively duplicated the existing login page (I guess I could have created a 'content' page but I think that would have presented different issues).

It appeared the quickest solution (albeit a slight 'hack') was to add an 'else' at line 62 as follows to ensure the 'static' content is picked up and the pane displayed.

if (!SiteUtils.IsNoMenuPage())
    //...
else
{
    //MS - This is a no-menu page and so we'll just check to see if there are any
    //child controls in each placeholder in order to work out whether we show the pane as
    //we won't have any 'modules' as such
    leftModuleCount = this.leftContent.Controls.Count;
    rightModuleCount = this.rightContent.Controls.Count;
}

This seems to work fine, but there may be a better solution (renaming the variables to reflect 'content' rather than 'module' at the very least.

I'd be interested in your thoughts.  I've got some other updates I'd like to run past you (around extending some of the standard controls), but I'll create separate threads for those...

Thanks again Joe,

Matt
 

4/30/2008 7:36:37 AM
Gravatar
Total Posts 18439

Re: Customised Login Page

I would just put everything inside the center content pane. There should be no problem creating a 2 column layout inside it that looks the same as if you had used the right side content pane. Then you don't need any code modifications in layout.master.

I would create the custom login page in an external project and copy it (just the .aspx part) to the Web/Secure folder using a post build event.

Hope it helps,

Joe

4/30/2008 8:17:06 AM
Gravatar
Total Posts 15

Re: Customised Login Page

Thanks Joe,

I've got the page in an external project already.  I have to admit I hadn't considered the two column layout - that's probably all I need (got it working after overriding some default CSS styles), although I'd like to actually have the option of showing the site menu (which would mean renaming the file to something other than login.aspx - again due to the logic in the master page.)  I'll probably leave it at that for now.

Cheers,

Matt

4/30/2008 8:25:17 AM
Gravatar
Total Posts 18439

Re: Customised Login Page

I think it is generally best practice not to show menus and actually to show as little else as possible on login pages myself.

But you could rename it to SignIn.aspx and it would still have a reasonable name and could show the menu.

Best,

Joe

4/30/2008 8:28:58 AM
Gravatar
Total Posts 15

Re: Customised Login Page

Hi Joe,

Just realised the LoginLink control needs to be updated to use the new config setting. 

My local change (line 88) is ...

string urlToUse = SiteUtils.GetNavigationSiteRoot() + SiteUtils.GetLoginRelativeUrl();
 

Don't think there's any other place that needs to be updated, but I'll let you know if I come across anything.

Cheers,

Matt

4/30/2008 8:35:26 AM
Gravatar
Total Posts 18439

Re: Customised Login Page

I think you must not have the latest code ther. My code already handles it correctly.

string urlToUse = "~" + SiteUtils.GetLoginRelativeUrl();
if (CssClass.Length == 0) CssClass = "sitelink";
SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
if ((siteSettings != null) && (siteSettings.SiteFolderName.Length > 0))
{
urlToUse = siteSettings.SiteRoot + SiteUtils.GetLoginRelativeUrl();
}

the first line is 88 and it uses the ~ appended to the begining of relative login url and this resolves correctly as the site root. The special case handled below that line is only used if using multiple sites based on folder name instead of host name.

Best,

Joe

4/30/2008 8:58:18 AM
Gravatar
Total Posts 15

Re: Customised Login Page

Ah yes - it's almost midnight here - my apologies

You must sign in to post in the forums. This thread is closed to new posts.