Hello,
I am fairly new to PHP so i apologize if my error is something to do with that. So far in this form everything is working except for the saving of the new password so that the user can log in. The following is the code i am using at the end of the form to try to save the new password.
<?php
$password = $this->data['new_password'];
$hash = JuserHelper::hashPassword($password);
$passwords = array(
'password' => $hash,
'confirm_password' => $hash
);
$user_id = JUserHelper::getUserId($this->data['username']);
$user = JFactory::getUser($user_id);
$user->password_clear;
$user->bind($passwords);
$user->save();
$result = JUserHelper::verifyPassword($password, $hash, $user_id);
echo $result;?>
When i echo the result from the verify password function, it returns 1, so i'm not sure when i try to sign the profile in, it fails. This is the output from the debugger for this event in the form.
Thanks!
I am fairly new to PHP so i apologize if my error is something to do with that. So far in this form everything is working except for the saving of the new password so that the user can log in. The following is the code i am using at the end of the form to try to save the new password.
<?php
$password = $this->data['new_password'];
$hash = JuserHelper::hashPassword($password);
$passwords = array(
'password' => $hash,
'confirm_password' => $hash
);
$user_id = JUserHelper::getUserId($this->data['username']);
$user = JFactory::getUser($user_id);
$user->password_clear;
$user->bind($passwords);
$user->save();
$result = JUserHelper::verifyPassword($password, $hash, $user_id);
echo $result;?>
When i echo the result from the verify password function, it returns 1, so i'm not sure when i try to sign the profile in, it fails. This is the output from the debugger for this event in the form.
Array ( [chronoform] => getemailtoresetpassword [event] => SubmitPassword [code] => e60af57e-0048-4cc8-8e27-c4afcdd73de0 [new_password] => (user input password) [confirm_new_password] => (user input password) [button20] => [9e3967586b45408db35403ac4a031dd7] => 728316dcc8ce388217ef8a0b5b7be40c [683d865b099a1c3b4c7dab97e603f0ed] => d38c0d472a9e53c7f629805fe28af333 [vfdis] => 1574787389618 [Itemid] => 708 [option] => com_chronoforms6 [view] => form [acy_source] => joomla [email] => (user input email) [username] => adafsdgf [button3] => [fpdis] => 1574789415556 [fpdis2] => 1574789415556 [fpdis3] => 1574789415557 )Array ( [SubmitPassword_validate_fields] => Array ( [log] => Automatic validation enabled. [var] => 1 ) [joomla_login13] => Array ( [_error] => User login failed. [var] => ) )Any input would be greatly appreciated, i have been banging my head against the wall on this one for too long now.
Thanks!