Copied to clipboard

Flag this post as spam?

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


  • Chris Soto 13 posts 33 karma points
    Jul 09, 2012 @ 16:12
    Chris Soto
    0

    Force Generate Password on Member Update

    Hi,

    I'm using CMSImport Pro 2.1.1 on Umbraco 4.7.1. 

    I have around 1000 users that were imported a while ago with the password hash used as the password. I am trying to update them by querying the cmsMember table as a source, using Update Record where member exist, Automatic Generate Password, and Email Credentials checked in hopes of generating new passwords for these users and emailing them their credentials. Unfortunately, this doesn't seem to generate a new password or email the credentials.

    Other operations have been done on these members since the import by different people; so, I want to avoid removing them and re-importing.

    Is there an easy way to this?

    Thanks,

    -Chris

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Jul 09, 2012 @ 16:37
    Richard Soeteman
    0

    Hi Chris,

    Yes only newly updated members will get a new password and confirmation email. Otherwise all updated members will get new passwords and confirmation emails. This should only be the case on new imported members. What you could do is generate the password using Membership.GeneratePassword(Membership.MinRequiredPasswordLength, Membership.MinRequiredNonAlphanumericCharacters) in the RecordImported event (see page 37 of the manual )and then send the email yourself in case of an update.

    Sorry that there is no easy answer,

    Richard

     

  • Chris Soto 13 posts 33 karma points
    Jul 09, 2012 @ 20:21
    Chris Soto
    0

    Hi Richard,

    Thanks for the quick response.

    This is kind of a special case/one off, so I ended up doing a user control instead. I figured it was about the same amount of work, but gave me a little more flexibility for doing updates in the future.

    I'll likely use the RecordImported event for additional validation though. Is there a way to determine the member group the imported members are going to, or is it better to use a data adapter for that?

    In case it helps anyone else, the gist of the user control was:

    using umbraco.cms.businesslogic.member

    • Text box for where clause
    • Get Members button
    • Reset Password button
    • Grid View to review members
    Get Members:
    1. Select nodeid, loginname, email, passwordfunction() as "pass" from cmsMember + where clause
    2. Populate grid view
    Reset Password:
    Foreach gridviewrow in gridview.rows
    1. Member mem = new Member(int.parse(row.cells[0].Text))
    2. mem.ChangePassword(row.Cells[3].Text)
    3. mem.save()
    4. Send email
    It's fairly straight forward, but dangerous for the end users; so I removed the macro after I used it to ensure that it doesn't get used accidentally.
    Thanks again,
    -Chris
  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Jul 10, 2012 @ 08:54
    Richard Soeteman
    0

    Hi Chris,

    Thanks for the detailed reply. You mean for assigning members against a database column?You could use the RecordImporting event. This gives you the Member object and the items collection holding the data from the datasource so you can easily map that against the membergroups.

    Hope this helps,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft