New User Registration - against database.

Permalink
I'm setting up a new site where I have an external database that contains user information. I already know how to access the external database, (via help here. Thank you!)

What I need to be able to do is have a new user enter certain information - a member ID that they already have, a first name, a date of birth, last 4 of a SSN, and then I need to match that against the external database. If it matches, then I allow them to register as a new user, and then I need to add the user to a couple groups, and update a couple attributes with data from the external database (some internal IDs that the member doesn't know).

I first started creating an external page, and then built the logic that way. I programmatically add the user, and update the groups/attributes. So far it works, but I'm not sure if this is the correct way to go.

Should I be using Authentication Types? I'd like the be able to use the email confirmation function built into the standard new user registration. Using my method I don't think I can do that (unless there is some way to trigger the email to be sent). Once the user is registered, I just need to use a standard login block.

a) should I be trying to use authentication types?
b) or, is there a way to trigger the email verification without using the standard registration?

 
drdobell replied on at Permalink Reply
Maybe I found part of my answer. I found this thread:

https://www.concrete5.org/community/forums/customizing_c5/add-user-a...

It looks like it's sending the email, but then asking for a password change. I need something similar. Can anyone help me figure out the add_user monitoring that only sends the email verification?
hutman replied on at Permalink Reply
hutman
You can trigger these emails when you programatically create the user. I have copied this code from the 5.8.1 core, but you can copy it from the /concrete/controllers/single_page/register.php of whatever version you are using, it's inside the do_register function.

In this case $process is the UserInfo object returned from the registration.

// now we check whether we need to validate this user's email address
if ($config->get('concrete.user.registration.validate_email')) {
    $uHash = $process->setupValidation();
    $mh = $this->app->make('mail');
    $fromEmail = (string) $config->get('concrete.email.validate_registration.address');
    if (strpos($fromEmail, '@')) {
        $fromName = (string) $config->get('concrete.email.validate_registration.name');
        if ($fromName === '') {
            $fromName = t('Validate Email Address');
        }
        $mh->from($fromEmail,  $fromName);
    }
    $mh->addParameter('uEmail', $_POST['uEmail']);
    $mh->addParameter('uHash', $uHash);
    $mh->addParameter('site', tc('SiteName', $config->get('concrete.site')));
drdobell replied on at Permalink Reply
That's just what I was looking for. Thank you!