Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have created an Umbraco Website with membership features. I have managed to create the registration form, so it will register custom data for me.
I would like to filter fake registrations and people who regret their registration right away. I usually do this by sending people an email with a link they have to click in order to verify their registration and actually activate their account.
Normally I solve this by setting a bit in the database to indicate Active/Inactive. But since I now just use the built in .NET login form:
I don't have any way to check for such a bit. I have thought of a few different scenarios to solve this:
1) The bit already exists in Umbraco, and I just don't know where.
2) Extend the login form, by creating a custom login form that can check for such a bit.
3) Solve this with User Groups. Add the newly registered users to a user group called "Inactive members", and move the user to the correct user group when they click the activate link.
I would prefer number 1. Number 2 is not that difficult, but number 3 seems to be the "cleanest" way of doing it within the Umbraco framework.
Any thoughts or recommendations on this?
On an umbraco v3 site have solved it with groups, exactly as you described it in 3. Was really simple.
[quote]Normally I solve this by setting a bit in the database to indicate Active/Inactive. But since I now just use the built in .NET login form
You still can, check the bit in the LoggingOn event, and cancel logging in if member not yet active.
using the login, you know who's logging on, get the member associated with the provided login credentials and check that active property using member.getProperty("IsActive").Value
Your third option is also viable, but still requires 'code changes' for the login control as in that case you'd need to check whether user is in correct group
Bottom line: I'd go for the extra bit (IsActive property on the member type), check active property upon login (LoggingOn event - cancel if not yet active), use activation link to set active property
If you don't want to use the Logging_X events on the login control, consider overriding the ValidateUser behaviour (Tim has done a great small tutorial on that); it implies building a custom membership provider tho...
Thank you for your swift reply. I decided to give it a quick try, and it turned out to be very simple indeed.
I implemented the custom membership provider and then added two new properties to the member type;
- Active (as described by Nibble)
- ActivationCode (one I added, which was a textstring that contains a Guid)
I have included the code I have created, if anyone wants to have a look. It might help others. There is some extra code in addition to the code supplied by Nibble. The code was written in a hurry, so the response messages could be done prettier, but it works.
At registration time I generate a new guid that I put in the ActivationCode property.
[code]MemberType demoMemberType = MemberType.GetByAlias(this.MemberTypeAlias);
MemberGroup addToMemberGroup = MemberGroup.GetByName(this.MemberGroupName);
Member newMember = Member.MakeNew(txtName.Text, demoMemberType, new umbraco.BusinessLogic.User(0));
newMember.Email = txtEmail.Text;
newMember.Password = txtPassword.Text;
newMember.LoginName = txtUsername.Text;
Guid activationCode = Guid.NewGuid();
newMember.getProperty("active").Value = false;
newMember.getProperty("activationCode").Value = activationCode.ToString();
Then I send an email to the newly created member with a link that is formatted like this:
Did you check this article allready seems to me that it should do the trick?
The above worked perfectly. Thank you very much, it was just what I needed!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted