public class MailEventHandler : ApplicationBase
{
public MailEventHandler()
{
Member.AfterNew += MemberAfterNew;
}
protected void MemberAfterNew(object sender, PublishEventArgs e)
{
//Send mail here
}
}
With this approach you can not send the password if you use the hashed version in the DB.
If members sign up on the website, then you could also just send a mail after they finish the signup process. Then the password would probably be available from the textbox.
I am using v4.0.1 and the passwords are hashed. I am not allowing users to sign up on the site, the admin will manually create the users. After the user is created I would like to have an email sent out that will give the user their username and password to log into the site.
I am not sure that this is actually 100% possible using Mortens suggest approach at the moment. I think this bug http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=21611 prevents it at the current time. But I hope this bug is fixed with the upcoming 4.0.2 release.
I'm having a similar project where I was hoping to do some of the same stuff.
This post could also be of relevance on how to write the code when the bug is fixed I think. http://forum.umbraco.org/yafpostst8622MemberAfterNew-event-doesnt-trigger-MemberNewEventHandler.aspx
[quote=Ewatkins]I am using v4.0.1 and the passwords are hashed. I am not allowing users to sign up on the site, the admin will manually create the users. After the user is created I would like to have an email sent out that will give the user their username and password to log into the site.[/quote]
Since you are using hashed passwords, i don't think you will be able to send out the password, since you cannot decrypt it.
As passwords are hashed there's - thank god - no way to send the correct password via Umbraco's APIs. This is the way it should be.
What you would be looking at is creating your own create member control that would use the Umbraco APIs to create the Member and send the e-mail afterwards (without the use of events). As you got control over the form you could get the value of the password directly from the Textbox where it's not hashed as opposed to the APIs where it's returned hashed.
Send an email when a member is created?
Is there a way to send an email when a member is created that will contain their username and password to login?
In V4 there are events for that.
Something like (not tested)
public class MailEventHandler : ApplicationBase
{
public MailEventHandler()
{
Member.AfterNew += MemberAfterNew;
}
protected void MemberAfterNew(object sender, PublishEventArgs e)
{
//Send mail here
}
}
With this approach you can not send the password if you use the hashed version in the DB.
If members sign up on the website, then you could also just send a mail after they finish the signup process. Then the password would probably be available from the textbox.
I am using v4.0.1 and the passwords are hashed. I am not allowing users to sign up on the site, the admin will manually create the users. After the user is created I would like to have an email sent out that will give the user their username and password to log into the site.
Hi
I am not sure that this is actually 100% possible using Mortens suggest approach at the moment. I think this bug http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=21611 prevents it at the current time. But I hope this bug is fixed with the upcoming 4.0.2 release.
I'm having a similar project where I was hoping to do some of the same stuff.
This post could also be of relevance on how to write the code when the bug is fixed I think.
http://forum.umbraco.org/yafpostst8622MemberAfterNew-event-doesnt-trigger-MemberNewEventHandler.aspx
[quote=Ewatkins]I am using v4.0.1 and the passwords are hashed. I am not allowing users to sign up on the site, the admin will manually create the users. After the user is created I would like to have an email sent out that will give the user their username and password to log into the site.[/quote]
Since you are using hashed passwords, i don't think you will be able to send out the password, since you cannot decrypt it.
You might be able to capture the event when the admin creates the account and obtain the password before it is hashed.
Are you using the .NET membership controls?
As passwords are hashed there's - thank god - no way to send the correct password via Umbraco's APIs. This is the way it should be.
What you would be looking at is creating your own create member control that would use the Umbraco APIs to create the Member and send the e-mail afterwards (without the use of events). As you got control over the form you could get the value of the password directly from the Textbox where it's not hashed as opposed to the APIs where it's returned hashed.
Cheers,
Niels...
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.