+
+ // Get registration data by auth_key
+ $rows = getWernisRegistrationDataByKey('api_auth_key', $args['auth_key']);
+
+ // The userid should be same
+ assert(isset($rows[0]['wernis_userid']));
+ assert($rows[0]['wernis_userid'] === $args['wernis_userid']);
+
+ // Check both challenge + response
+ assert(isset($rows[0]['api_redirect_challenge']));
+ assert(isset($rows[0]['api_challenge_response']));
+
+ // Both are fine, so get the data
+ $return = doWernisFinishUserRegistration($rows[0]['api_redirect_challenge'], $rows[0]['api_challenge_response'], '1');
+
+ // All fine?
+ if ($return === FALSE) {
+ // @TODO Should not happen???
+ reportBug(__FUNCTION__, __LINE__, 'args=<pre>' . print_r($args, TRUE) . '</pre>rows=<pre>' . print_r($rows, TRUE) . '</pre> - Failed!');
+ } // END - if
+
+ // Generate URL
+ $url = basename(detectRequestUri()) . '&challenge=' . $rows[0]['api_redirect_challenge'] . '&__challenge_response=' . $rows[0]['api_challenge_response'] . '&status=1';
+
+ // Redirect to URL
+ redirectToUrl($url);