ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

register without a password

July 25, 2007 3:28pm

Subscribe [8]
  • #1 / Jul 25, 2007 3:28pm

    shaz

    21 posts

    I was searching for a way to do this but I am not sure what exactly to search for, so please forgive me if this is already covered.

    I want to setup a registration form where the password is automatically generated - so I just want users to set up a username and other profile info, but for the password fields to be hidden and automatically generate. I am looking for an easy way to do this - any help is appreciated.

    thanks.

  • #2 / Jul 26, 2007 11:39am

    Robin Sowell

    13255 posts

    If they don’t know their password, how will they log in for future visits?  I’d imagine it’s easy enough to do- either hack or write an extension to the mod.member_register.php file.  But I’m fuzzy on the goal- keep in mind, the passwords are encrypted, so once you generate a random one, nobody is going to be able to figure out what the actual password is in order to log in.

  • #3 / Jul 26, 2007 12:10pm

    shaz

    21 posts

    thanks for you response Robin - when I was importing my textpattern data into ee, the process made accounts for all the people that made comments - it basically automatically created a password and indicated that a user could just use the ‘forget password’ function to retrieve their password. This is what I want to happen. The thing is that I want the profile info to be created and I want to ability for them to login in the future if need arises, but for now, I don’t offer the control panel or any membership functionality - I just want to collect some profile info. I don’t know how to create extensions, but if someone can easily help me out, I would be very appreciative.

    Thanks!

  • #4 / Jul 26, 2007 12:40pm

    Robin Sowell

    13255 posts

    OK- I think this should get you started.  You’d want to edit the registration template and remove the password and password confirm fields.  Now I think I’d probably put in a check on the db to prevent duplicate passwords.  I didn’t here.  And it’s untested.  But I think the basic logic is solid.  Should make for a starting point- would need to be named ext.auto_pass.php and uploaded to your extension folder.  Like I say- consider it a starting point.

    <?php
    
    class Auto_pass
    {
    var $settings  = array();
    
    var $name   = 'Password generator';
    var $version   = '1.0.0';
    var $description  = 'Creates a random password';
    var $settings_exist  = 'n';
    var $docs_url  = '';  //'http://expressionengine.com';
    
    // -------------------------------
    //   Constructor - Extensions use this for settings
    // -------------------------------
    
    function Auto_pass($settings='')
    {
      $this->settings = $settings;
    }
    // END
    
    // -------------------------------
    //   Send the mail
    // -------------------------------
    
    function make_password()
    {
    global $FNS;
    
    $rand = $FNS->random('alpha', 8);
    
    $_POST['password'] = $rand;
    $_POST['password_confirm'] = $rand;
    
    return;
    
    }
    
    
    // --------------------------------
    //  Activate Extension
    // --------------------------------
    
    function activate_extension()
    {
      global $DB;
      
      $DB->query($DB->insert_string('exp_extensions',
               array(
               'extension_id' => '',
               'class'  => "Auto_pass",
               'method'    => "make_password",
               'hook'   => "member_member_register_start",
               'settings'  => "",
               'priority'  => 10,
               'version'   => $this->version,
               'enabled'   => "y"
                )
              )
          );
    }
    // END
    
    
    // --------------------------------
    //  Disable Extension
    // --------------------------------
    
    function disable_extension()
    {
      global $DB;
    
      $DB->query("DELETE FROM exp_extensions WHERE class = 'Auto_pass'");
    }
    // END
    
    
    
    }
    // END CLASS
    
    ?>
  • #5 / Jul 31, 2007 11:02pm

    shaz

    21 posts

    This is excellent Robin! thanks so much!! 😊

  • #6 / Aug 31, 2007 1:31am

    stinhambo

    1268 posts

    I am looking for the same kind of functionality. I am working on a system similar to www.hurricanearchive.org where people can add their resources to EE, tag them etc and people can search for them via tags or themes etc.

    To submit something, the client wants people to add their name, email and contact number and confirmation that they own the copyright to that content.

    What I want to achieve is a way for people to be able to add something without having to add those details every time so perhaps a system that on the first submit, a membership is generated using their email address as a username and a random password that gets emailed to them.

    Then the admin team can contact them via their membership details page. All submissions are subject to admin approval via custom status (for approval, approved, rejected) etc.

  • #7 / Aug 31, 2007 7:31am

    Daniel Walton

    553 posts

    Robin is on the right track (I’ve literally this minute just finished this exact extension for a client).  The next function you’ll need to write will hook into whatever activation method your membership is set to (admin activation in my case) and send an additional email with the username and password. There is one slight problem though and that is you don’t know what that user’s password is meant to be, easily solvable by just running the same $FNS->random(‘alpha’, 8); and overwrite their old (unused) one with that.

  • #8 / Aug 21, 2008 4:59pm

    bkuberek

    124 posts

    Robin is on the right track (I’ve literally this minute just finished this exact extension for a client).

    Is your extension something you can share? I would really like to take a look at it.

    Thanks

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases