Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationCustom validation advice help neededCustom validation advice help needed
Previous
 
Next
New Post
4/15/2008 9:21 AM
 

"Perilous core change" - Is that advice against changing the source for a released core module (perhaps in light of having to do it again with the next release) or is there an inherent issue with making the methods in AspNetMembershipProvider overridable?  I also had incorporated some changes into the membership provider, by cloning the provider project - and am considering the issues of having to update at some point.

 

So I ask - would there be any harm/danger in marking the methods in AspNetMembershipProvider as overridable?  I understand that on an upgrade each overridden method would have to be looked at for functionality changes, but at least we should be able to limit the amount of code merging that is being done that way, instead of having to merge every single method.

 

 
New Post
4/17/2008 1:36 PM
Accepted Answer 

Hi Niel,

Your strategy appears sound.  When integrating the UpmMembershipProvider with DNN some time ago, I also was forced to decorate it to address some incompatibilities between DNN and Commerce Server.

With respect to (a), find below the code that I use to create a user when (1) remote validation succeeds and (2) local validation fails.  Note that it ultimately calls base.CreateUser versus this.CreateUser, because this.CreateUser is overridden and would cause an infinite loop.  Also, an empty PreferredLocale will cause problems down the road -- so do not leave it blank.

 

protected UserCreateStatus CreateLocalUser(int portalId, string userName, string password, UserInfo user)string portalName = PortalController.GetCurrentPortalSettings().PortalName;var Webservices = WebserviceFactory.Create();var LegacyUser = Webservices.GetUserData(PortalName, userName, password);if(user == null)throw new ArgumentNullException("user");else if(string.IsNullOrEmpty(userName))throw new ArgumentNullException("userName");// Hydrate the UserInfo object

user.PortalID = portalId;

user.FirstName = LegacyUser.FirstName;

user.LastName = LegacyUser.LastName;

user.Email = userName;

user.Profile.InitialiseProfile(portalId);

user.Username = userName;

user.Membership.Password = password;

user.Membership.Approved = True;

user.AffiliateID = LegacyUser.UserID;

user.DisplayName =

user.Profile.Unit =

user.Profile.Street = LegacyUser.StreetAddress;

user.Profile.City = LegacyUser.City;

user.Profile.Region =

user.Profile.PostalCode = LegacyUser.ZipCode;

user.Profile.Country =

user.Profile.Telephone = LegacyUser.Telephone;

user.Profile.Cell = LegacyUser.Cell;

user.Profile.Fax =

user.Profile.IM =

user.Profile.Website =

user.Profile.PreferredLocale =

user.Profile.TimeZone = 0;

 

 

 

 

user.Profile.FirstName = user.FirstName;

user.Profile.LastName = user.LastName;

 

string.Format(CultureInfo.InvariantCulture, "{0} {1}", LegacyUser.FirstName, LegacyUser.LastName).Trim();string.Empty;string.Empty;"USA";string.Empty;string.Empty;string.Empty;"en-US";if(string.IsNullOrEmpty(user.DisplayName)) user.DisplayName = userName;if(string.IsNullOrEmpty(user.FirstName)) user.FirstName = "Unknown";if(string.IsNullOrEmpty(user.LastName)) user.LastName = "Unknown";if(string.IsNullOrEmpty(user.Email)) user.Email = string.Empty;// Create the DNN user

 

}

Regarding (b), I do not believe I've added a user to a role in code before.  Your code looks solid, and would be my initial approach as well.  During user creation, UserController executes similar code (Components/Users/UserController.vb on or about line177), but does not appear to make a call to controller.UpdateRole.  My guess is that's your bad call.  DNN also seems to generally use Null.NullDate for the date parameters.

Hope this helps!

Brandon

return base.CreateUser(user);

{

 

 

 

 

 

 

 

 


Brandon Haynes
BrandonHaynes.org
 
New Post
4/17/2008 1:44 PM
 

Hi Thierry,

I am not aware of any particular hazard in converting the methods in AspNetMembershipProvider to be virtual.  My caution was against your former suggestion: maintaining these changes across versions can be problematic.  In one concrete example, I was forced to make some core changes to the DNN authentication system.  When this system radically changed in the 4.7 - 4.8 timeframe, I was forced to significantly re-engineer these changes.  Not fun.

However, to maintain backwards-compatibility, the signatures of the methods in AspNetMembershipProvider are unlikely to change anytime soon, and inserting an "overridable" modifier into one of those functions is unlikely to be too problematic.  I've been forced to use this approach in a number of instances. 

It's a shame that some of these methods aren't already marked virtual.  Could I perhaps suggest that you log this as an issue in Gemini at support.dotnetnuke.com?  Such a change would be of benefit to quite a few, I would think.

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
5/1/2008 5:45 PM
 

Thanks for the all guidance. I have ended up keeping well away from AspNetMembershipProvider for forward compatibility reasons and simply putting a decorator around it. This has let me use all its methods and override the one or two I needed to change.

A major decision I have made to simplify the user story for first time logins is to always use the registration process with email verification. This means I never have to create a user myself and only need check the remote authenticating database once the email address has been verified. It turns out I am only interested in a getting a set of roles from the database and whether the current email address is in or out of them, so this has further simplied things.

Adding and deleting roles using the remote authenticating database has also worked out well.

By changing the web.config reference all my portals in the instance use the Custom version. I am working on how to make this portal specific, but don't need this functionality for today's client.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationCustom validation advice help neededCustom validation advice help needed


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out