Re-Design Login page to match current login look

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.
3/19/2009 9:56:34 PM
Gravatar
Total Posts 6

Re-Design Login page to match current login look

Has anyone customized the login page at all??  I have seen some brief forum posts from a while back but dont seem to find anything detailing if anyone has.

Basically what i am looking to do is replace our current login page.  We currently have a secure login page on the corporate site and it takes you to our intranet portal.  The secure login looks like our corporate site design and the mojoportal intranet skin is going to be very different.  My preference would be to have a relatively plain page that i can possibly re-tool the graphics like our corporate site just for the login page.  The corporate design doesnt really fit the intranet model.  Is what i am looking to do possible at all?  Any one done this or have any examples?

thanks,

glenn

3/20/2009 6:02:11 AM
Gravatar
Total Posts 18439

Re: Re-Design Login page to match current login look

Some people do implement their own custom login page and registration page. One technique is to create the page in a separate project and use a post build event to copy it up to the mojoportal /Secure folder overwriting the existing page.

Hope it helps,

Joe 

3/20/2009 6:17:59 AM
Gravatar
Total Posts 6

Re: Re-Design Login page to match current login look

Joe,

I tried that last night.  I took the current login page and pulled the main portal:SiteLogin control and put it into a blank page.  So basically had it in raw html rather than in a master page.  I kept getting an error saying child controls can only be in a master page.  So it was like something was still trying to work on a master page for some reason.  The only way i could revamp the login page and keep all the functionality there was to add custom css classes to a copy of the default login page that by tag id hide the header and footer of the page.  But then i am basically left with a blank canvas and cant add a whole lot of design easily.

Theres no way to pass from some other page the user id and password without having to physically go through the mojo portal login.aspx page correct?

thanks,

glenn

 

3/20/2009 6:46:59 AM
Gravatar
Total Posts 18439

Re: Re-Design Login page to match current login look

 Here is a working example of a very plain login page that you can style or modify as needed. Create a text file named Login.aspx and paste this into it then drop it in replacing the old one (maybe back it up first).

<%@ Page Language="C#" ClassName="SignIn.aspx" Inherits="System.Web.UI.Page" %>
<%@ Import Namespace="mojoPortal.Business" %>
<%@ Import Namespace="mojoPortal.Business.WebHelpers" %>
<%@ Import Namespace="mojoPortal.Web" %>
<%@ Import Namespace="mojoPortal.Web.UI" %>
<%@ Import Namespace="mojoPortal.Web.Framework" %>
<%@ Import Namespace="mojoPortal.Web.Controls" %>
<%@ Import Namespace="mojoPortal.Net" %>
<%@ Import Namespace="Resources" %>

<script runat="server">

//Constituent controls inside LoginControl
private SiteLabel lblUserID;
private SiteLabel lblEmail;
private TextBox UserName;
private TextBox Password;
private CheckBox RememberMe;
private Button Login;
private HyperLink lnkPasswordRecovery;
private HyperLink lnkRegisterExtraLink;
private SiteSettings siteSettings = null;
protected string PageTitle = string.Empty;

protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
}

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

if (!WebConfigSettings.RunningInMediumTrust)
{
OpenIdLoginControl oidLogin = (OpenIdLoginControl)Page.LoadControl("~/Controls/OpenIDLoginControl.ascx");

oidLogin.ID = "oidLogin";
pnlOpenID.Controls.Add(oidLogin);
}
}

protected void Page_Load(object sender, EventArgs e)
{
siteSettings = CacheHelper.GetCurrentSiteSettings();
if (WebConfigSettings.SslisAvailable) SiteUtils.ForceSsl();
SecurityHelper.DisableBrowserCache();

lblUserID = (SiteLabel)this.LoginCtrl.FindControl("lblUserID");
lblEmail = (SiteLabel)this.LoginCtrl.FindControl("lblEmail");
UserName = (TextBox)this.LoginCtrl.FindControl("UserName");
Password = (TextBox)this.LoginCtrl.FindControl("Password");
RememberMe = (CheckBox)this.LoginCtrl.FindControl("RememberMe");
Login = (Button)this.LoginCtrl.FindControl("Login");
lnkPasswordRecovery = (HyperLink)this.LoginCtrl.FindControl("lnkPasswordRecovery");
lnkRegisterExtraLink = (HyperLink)this.LoginCtrl.FindControl("lnkRegisterExtraLink");

 

PopulateLabels();
pnlOpenID.Visible = WebConfigSettings.EnableOpenIdAuthentication && siteSettings.AllowOpenIdAuth;
pnlWindowsLive.Visible
= WebConfigSettings.EnableWindowsLiveAuthentication
&& siteSettings.AllowWindowsLiveAuth
&& siteSettings.WindowsLiveAppId.Length > 0;

if ((siteSettings.UseEmailForLogin)&&(!siteSettings.UseLdapAuth))
{
if (!WebConfigSettings.AllowLoginWithUsernameWhenSiteSettingIsUseEmailForLogin)
{
RegularExpressionValidator regexEmail = new RegularExpressionValidator();
regexEmail.ControlToValidate = UserName.ID;
regexEmail.ValidationExpression = @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$";
regexEmail.ErrorMessage = Resource.LoginFailedInvalidEmailFormatMessage;
this.LoginCtrl.Controls.Add(regexEmail);
}

}

}

private void PopulateLabels()
{

this.PageTitle = siteSettings.SiteName + " - " + Resource.LoginLink;


if (siteSettings.UseEmailForLogin && !siteSettings.UseLdapAuth)
{
this.lblUserID.Visible = false;
}
else
{
this.lblEmail.Visible = false;
}

this.UserName.Focus();

lnkPasswordRecovery.Visible = siteSettings.AllowPasswordRetrieval && !siteSettings.UseLdapAuth;
lnkPasswordRecovery.NavigateUrl = this.LoginCtrl.PasswordRecoveryUrl;
lnkPasswordRecovery.Text = this.LoginCtrl.PasswordRecoveryText;

lnkRegisterExtraLink.NavigateUrl = "Register.aspx";
lnkRegisterExtraLink.Text = Resource.RegisterLink;
lnkRegisterExtraLink.Visible = siteSettings.AllowNewRegistration;

string returnUrlParam = Page.Request.Params.Get("returnurl");
if (!String.IsNullOrEmpty(returnUrlParam))
{
//string redirectUrl = returnUrlParam;
lnkRegisterExtraLink.NavigateUrl += "?returnurl=" + returnUrlParam;
}

RememberMe.Visible = WebConfigSettings.AllowPersistentLoginCookie;
RememberMe.Text = this.LoginCtrl.RememberMeText;

Login.Text = this.LoginCtrl.LoginButtonText;
SiteUtils.SetButtonAccessKey(Login, AccessKeys.LoginAccessKey);
}

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title><% = PageTitle %></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Panel id="pnlLogin" runat="server" CssClass="panelwrapper login">
<div class="modulecontent">
<fieldset>
<legend>
<mp:SiteLabel id="SiteLabel1" runat="server" ConfigKey="SignInLabel" UseLabelTag="false"></mp:SiteLabel>
</legend>
<asp:Panel ID="pnlStandardLogin" runat="server" CssClass="floatpanel">
<portal:SiteLogin ID="LoginCtrl" runat="server" CssClass="login" >
<LayoutTemplate>
<div class="settingrow">
<strong><mp:SiteLabel id="lblEmail" runat="server" ForControl="UserName" ConfigKey="SignInEmailLabel"></mp:SiteLabel>
<mp:SiteLabel id="lblUserID" runat="server" ForControl="UserName" ConfigKey="ManageUsersLoginNameLabel"></mp:SiteLabel></strong>
<br /><asp:TextBox ID="UserName" runat="server" Columns="35" MaxLength="100" />
</div>
<div class="settingrow">
<strong><mp:SiteLabel id="lblPassword" runat="server" ForControl="Password" ConfigKey="SignInPasswordLabel"></mp:SiteLabel></strong>
<br /><asp:TextBox ID="Password" runat="server" TextMode="password" />
</div>
<div class="settingrow">
<asp:CheckBox ID="RememberMe" runat="server" />
</div>
<div class="settingrow">
<asp:Button ID="Login" CommandName="Login" runat="server" Text="Login" />
<br /><asp:Label ID="FailureText" runat="server" CssClass="txterror" EnableViewState="false" />
</div>
<div class="settingrow">
<asp:HyperLink ID="lnkPasswordRecovery" runat="server" />&nbsp;&nbsp;
<asp:HyperLink ID="lnkRegisterExtraLink" runat="server" />
</div>

</LayoutTemplate>
</portal:SiteLogin>
</asp:Panel>
<div class="floatpanel">
<asp:Panel ID="pnlOpenID" runat="server" Visible="false">

</asp:Panel>
<asp:Panel ID="pnlWindowsLive" runat="server" Visible="false">
<div style="padding: 0px 0px 0px 6px;">
<portal:WindowsLiveLoginControl ID="livelogin" runat="server" />
</div>
</asp:Panel>
</div>
</fieldset>
</div>
</asp:Panel>
</form>
</body>
</html>

 

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