|
|
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
|
|
|
|
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...
|
|
|
|
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?
|
|
|
|
A good ressource for examples are the
authentication modules that are on the gallery. I'm sure you can figure out how to do it just by reading the code, it's pretty straightforward. And last but not least there is the
default MembershipService that ships with Orchard. I assume it shouldn't be to hard to implement a custom service when checking out what's going on in there and how the other modules work.
Best regards
Jay
|
|
|
|
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;
}
|
|