How to change the authentication provider of the Register/Login actions?

Topics: Core, General, Writing modules
Jan 13, 2013 at 10:56 PM

Hi,

I'd like to ask, if anyone knows:

  • When user registered, how to store their registration details (username, password, email etc.) into a custom database (via a web service)?
  • Also, when a user login, how to use that custom database to authenticate the user?

 

Many thanks,

Jim

Jan 14, 2013 at 6:45 AM

In a custom module override MembershipService from the Orchard.Users module.  

[OrchardSuppressDependency("Orchard.Users.Services.MembershipService")]
public class MembershipService : IMembershipService {
   //and so on implementing the service...

Jan 16, 2013 at 11:18 AM
BrandonJoyce wrote:

In a custom module override MembershipService from the Orchard.Users module.  

 

[OrchardSuppressDependency("Orchard.Users.Services.MembershipService")]
public class MembershipService : IMembershipService {
   //and so on implementing the service...

 

Thanks Brandon,

Do you have an example about how this function is implemented?

 

Jan 16, 2013 at 4:59 PM

Thanks Jay,

I think my problem is, I'm not familiar with Orchard Class, so within the Default MemberShipService class, I'm not sure which part(s) can be removed/replace etc.

It would be good to see an example about how to override this class.

 

public class MembershipService : IMembershipService {
        private readonly IOrchardServices _orchardServices;
        private readonly IMessageManager _messageManager;
        private readonly IEnumerable<IUserEventHandler> _userEventHandlers;
        private readonly IEncryptionService _encryptionService;

        public MembershipService(IOrchardServices orchardServices, IMessageManager messageManager, IEnumerable<IUserEventHandler> userEventHandlers, IClock clock, IEncryptionService encryptionService) {
            _orchardServices = orchardServices;
            _messageManager = messageManager;
            _userEventHandlers = userEventHandlers;
            _encryptionService = encryptionService;
            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }

        public ILogger Logger { get; set; }
        public Localizer T { get; set; }

        public MembershipSettings GetSettings() {
            var settings = new MembershipSettings();
            // accepting defaults
            return settings;
        }