Hi!
I am using the Duo module on a Drupal Commerce site.
One feature of Drupal Commerce Kickstart is that if a guest user completes an order the system will look to see if the email address submitted is registered to a user. If it is not it will then create a new user account for the user and send a new account email.
Since installing the Duo module at order creation for a new guest user where an account is created the following error message is displayed to the user:
Notice: Undefined property: stdClass::$name in duo_user_insert() (Line 119 of /home/httpd/vhosts/traumlandschweiz.ch/httpdocs/sites/all/modules/contrib/duo/duo.module).
In researching this problem it appears that the following function(which contains line 119):
/**
* Implements hook_user_insert().
*/
function duo_user_insert(&$edit, $account, $category) {
// Make sure the user is creating it, not an admin.
global $user;
if (!$user->name && function_exists('hash_hmac') && user_access('log in with duo', $account) && $skey && $ikey && $akey && $api) {
if (duo_generate_second_auth($account->name)) {
drupal_exit();
}
}
}is asking for $name which since it is a new account is undefined and this causes an error.
It is undesirable for an user to see an error message upon order completion. The rest of the screen tells them it has been a successful order but then they see this:

I trust that the fix to this is relatively simple. Thank in advance for your time in fixing this!
God Bless!
Frederick
| Comment | File | Size | Author |
|---|---|---|---|
| Screenshot from 2015-11-25 16:39:18.png | 100.88 KB | frederickjh |
Comments
Comment #2
catapipperI recently created a patch that checked to see if the variables exist instead of just assuming they exist. Might work for you in this situation.
https://www.drupal.org/node/2697897#comment-11620533
Comment #3
frederickjhThanks catapipper!
I will try that patch. I am busy on another project right now but it is going on the todo list. Thanks for the heads up.
Frederick