Works fine in my tests. My guess is the user store is failing due to missing critical data. Ensure you're supplying username, email address, and name. Those are all required by Joomla. If password isn't provided it can generate one if the parameter is left empty. Example as follows.Ok for this, but I need help with the CB register autoaction that I may use to register users and which is not working whatever I tried
Even with a postman request there is no success.
return $actiondata['data1']->username;
Please Log in to join the conversation.
async registerUserAjax() {
const name = this.shadowRoot.getElementById('reg_name').value;
const firstname = this.shadowRoot.getElementById('reg_firstname').value;
const email = this.shadowRoot.getElementById('reg_email').value;
const username = this.shadowRoot.getElementById('reg_username').value;
const password = this.shadowRoot.getElementById('reg_password').value;
const data = {
lastname: name,
firstname: firstname,
email: email,
username: username,
password: password
};
const requestOptions = {
method: 'POST',
body: JSON.stringify(data)
};
// Remplacez "AUTOACTION_URL_HERE" par l'URL réelle pour enregistrer un nouvel utilisateur
try {
const response = await fetch(`${domain}/index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=330&Itemid=9343&format=raw`, requestOptions);
if (!response.ok) {
throw new Error(response.statusText);
}
const responseData = await response.json();
console.log("Texte de la réponse:", JSON.stringify(responseData));
if (responseData.success) {
console.log('Inscription réussie');
const token = responseData.token;
const firstname = responseData.firstname;
if (token) {
localStorage.setItem(page + "_token", token);
localStorage.setItem(page + "_isLoggedIn", 1);
localStorage.setItem(page + "_firstname", firstname);
await updateWebComponentState(true);
} else {
console.log('Token vide. Vérifiez la réponse du serveur.');
}
} else {
console.log('Échec de l\'inscription');
alert('Échec de l\'inscription. Veuillez vérifier les informations fournies. Votre identifiant ne doit comporter que des lettres et des chiffres, sans espaces.');
}
} catch (error) {
console.error('Error:', error);
alert('Une erreur s\'est produite lors de l\'inscription. Veuillez réessayer.');
}
}
Please Log in to join the conversation.
Then there's a problem with how data is being sent via POST. You can access request and get variables too (e.g. [request_name], [get_name]). Use whatever is necessary for your needs. Based off your sample you are not sending POST data correctly. You're sending a JSON encoded string. Use FormData to properly send a POST body object.It does not work with [post_fields] with Postman or my fetch function in javascript.
Then you have something acting on Joomla user store behavior interrupting the process.I can register a user like you did but the user is only registered as joomla user and does not appear as CB user.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
$app = Factory::getApplication();
$uri = new Uri($app->input->server->get('HTTP_REFERER', '', 'string'));
if (strpos($uri->toString(), 'actions=330') !== false) {
return false;
} else {
return true;
}
EGAL
true
Please Log in to join the conversation.