Thursday, April 8, 2010

Only allow approved members to Login + Umbraco

This is how I go about not allowing Umbraco members to login whn they haven't been approved.

In my MemberType I have a True/False datatype called Active.

On my MemberLogin user control page my asp.net member login control looks like



<asp:Login ID="lgMember" OnLoggingIn="Login1_LoggedIn" CssClass="login" VisibleWhenLoggedIn="false" DestinationPageUrl="/Members.aspx"
LabelStyle-VerticalAlign="middle" LabelStyle-CssClass="LoginLabel" TextBoxStyle-Width="100px" UserNameLabelText="Login"
PasswordLabelText="Password" TitleText="" DisplayRememberMe="false" runat="server" />

In the codebehind my Login1_LoggedIn event looks like.

protected void Login1_LoggedIn(object sender, EventArgs e)
{
//get member
Member m = Member.GetMemberByName(((Login)sender).UserName.ToString(), false).First();

if (m.getProperty("Active").Value.ToString() != "1")
{
FormsAuthentication.SignOut();
HttpContext.Current.Response.Redirect(umbraco.library.NiceUrl(1091));
}

}


This will redirect the user to a page explaining their membership hasn't been enabled yet.

Friday, April 2, 2010

nopCommerce and Umbraco

I have two major passions when it comes to .net open source projects and they are Umbraco and nopCommerce.  What I am planning on doing is building a nopCommerce package for Umbraco.  There are plenty of good commerce packages already for Umbraco and I have nothing against these packages I just love nopCommerce and would like to be able to use it within the Umbraco framework.  I don’t think is going to be a quick task and will probably need to be spanned over many months.  I’m going to try and blog what I do so other .Net applications might be able to use some of the challenges I encounter and how they might go about resolving them.   Please check back here regularly to check on my progress.  Will also try and get a package up into codeplex.  Wish me luck!