Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • fabio 87 posts 107 karma points
    Sep 21, 2011 @ 12:56
    fabio
    0

    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

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Sep 21, 2011 @ 13:30
    Richard Soeteman
    0

    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 

  • fabio 87 posts 107 karma points
    Sep 21, 2011 @ 13:54
    fabio
    0

    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

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Sep 21, 2011 @ 14:47
    Richard Soeteman
    0

    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

  • fabio 87 posts 107 karma points
    Sep 21, 2011 @ 15:20
    fabio
    0

    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

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Sep 21, 2011 @ 17:02
    Richard Soeteman
    0

    aha ok now its clear, sorry then you need to write your own email functionality. If you reference cmsimport.library this should work:

      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);
            }
  • fabio 87 posts 107 karma points
    Sep 21, 2011 @ 21:17
    fabio
    0

    hi richards

    thanks a lot

    your answer contains more then expected.

     

    fabio

  • fabio 87 posts 107 karma points
    Sep 27, 2011 @ 10:41
    fabio
    0

    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


  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Sep 27, 2011 @ 10:52
    Richard Soeteman
    0

    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

  • fabio 87 posts 107 karma points
    Sep 27, 2011 @ 11:37
    fabio
    0

    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'

  • fabio 87 posts 107 karma points
    Sep 27, 2011 @ 14:20
    fabio
    0

    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

  • fabio 87 posts 107 karma points
    Sep 27, 2011 @ 14:20
    fabio
    0
Please Sign in or register to post replies

Write your reply to:

Draft