I don't think this is possible without sending the email yourself. The cmsimport functionalty holds the generated or mapped password in a temporary variable . this will be used in the email then the password will be encoded.
I also think you need to use the imported event to be sure the member password never gets overwritten.
So in the imported event set the event and send the email. that shoudl work.
It is indeed not possible to set the password variable. I'm using the Membership.GeneratePassword indeed. If you are going to do that yourself I'm curious why you can't use the default password generator?
Error150An object reference is required for the non-static field, method, or property 'CMSImportLibrary.Config.CMSImportConfig.MailCredentialsSubject.get'
password injection
Hello and thanks in advice i'm using 1.1.1.0 version of your great plugin.
I have to inject password during the process of importing members, please don't ask why.
i've tried catching events as follow
MemberImport.Importing += new MemberImport.ImportingEventHandler(ContentImport_Importing);
.... ContentImport_Importing..... {
// do really dirty things.
}
I've tried setting directly the pwd via member obj, but on the email that the member receive is written one generated with the umbraco pwd provider.
Is there a way to inject the password, so it will be send in email template ?
thanks Fabio
HI Fabio,
I don't think this is possible without sending the email yourself. The cmsimport functionalty holds the generated or mapped password in a temporary variable . this will be used in the email then the password will be encoded.
I also think you need to use the imported event to be sure the member password never gets overwritten.
So in the imported event set the event and send the email. that shoudl work.
Hope this helps you,
Richard
hi richard and thanks for your answer
i saw that setting password in the imported event works.
if i understood well, there is no way to set the variable password, i mean the one on the email template, and reuse on cmsImport send mail, right?
But if a way exist......, please let me know...
Also if i remember well, your are generating password directly via System.Web.Security.Membership, right?
Fabio
Hi Fabio,
It is indeed not possible to set the password variable. I'm using the Membership.GeneratePassword indeed. If you are going to do that yourself I'm curious why you can't use the default password generator?
Thanks,
Richard
the default Membership.GeneratePassword on asp.net version we're using
can't permit to remove special character from password, we just can set
the minimum number of those character family.
if i'm wrong, i'll be happy to know.
fabio
aha ok now its clear, sorry then you need to write your own email functionality. If you reference cmsimport.library this should work:
hi richards
thanks a lot
your answer contains more then expected.
fabio
Hi Richard
i'm sorry to ask you again, but in the above example i can't find a way to access
CMSImportConfig properties, i get a compilation error, about tha unaccessibility of those properties in a static way
and i can't find any reference to a config obj via RecordImportedEventsArgs
HOw can i access the configuration?
regards
Fabio
Hi Fabio,
They should be in the class. It's all static and publi so it must be something else causing the issue. Can you post your example?
CMSImportLibrary.Config.CMSImportConfig
Thanks,
Richard
Hi Richard, thanks for your help
The Code:
private static void SendCredentialsMail ( Member member, string tmpPassword ) {
string fromAdress = CMSImportConfig.MailCredentialsFromAdress;
string toAdress = member.Email;
string subject = CMSImportConfig.MailCredentialsSubject;
string template = CMSImportConfig.MailCredentialsTemplate;
template = template.Replace( "[#loginname]", member.LoginName );
template = template.Replace( "[#password]", tmpPassword );
template = template.Replace( "[#email]", member.Email );
foreach (var prop in member.GenericProperties) {
template = template.Replace( string.Format( "[#{0}]", prop.PropertyType.Alias ), string.Format( "{0}", prop.Value ) );
}
library.SendMail( fromAdress, toAdress, subject, template, true );
}
Compilation Error:
Error150An object reference is required for the non-static field, method, or property 'CMSImportLibrary.Config.CMSImportConfig.MailCredentialsSubject.get'
HI richard
just to solve my specific issue, i re-read the config file, i know it's not so efficent.
and then i set the needed variables, if you know a better way please let me know,
otherwise don't waste your time, it's working .
thanks a lot for your help.
fabio
is working on a reply...