Password must be a string error on new user creation

momentis 27 Aug, 2014
I am using the Joomla User Registration action on a form, whcih I have done in the past. The form it is contained within, upon submission, creates the Joomla user, and then creates a record in another table, using the newly-created userid.

The form works correctly - adding both the new user and the table record. After submission, however, the following message is displayed:

Warning: password_hash(): Password must be a string in /home/hirschtr/public_html/qualified/libraries/compat/password/lib/password.php on line 30

Any ideas why this would be happening?

Rick
momentis 27 Aug, 2014
My form uses the following code to generate a random password for each user:

$form->data['user_password'] = rand(100000,999999);
$form->data['user_password_verify']=$form->data['user_password'];


The user is being created, but the password generated with this code is not saving with the record.
momentis 27 Aug, 2014
Full debug info:

Warning: password_hash(): Password must be a string in /home/hirschtr/public_html/qualified/libraries/compat/password/lib/password.php on line 30
Data Array:

Array
(
    [option] => com_chronoforms
    [chronoform] => add_qualified_customer
    [event] => submit
    [user_firstname] => Rick
    [user_lastname] => Stoffiere
    [user_company] => The GRA Group
    [user_email] => REDACTED@gmail.com
    [user_fullname] => Rick Stoffiere
    [user_username] => REDACTED
    [user_password] => 486762
    [user_password_verify] => 486762
    [trv_trips] => 0
    [input_submit_12] => CREATE USER
    [e8f16bec71e4ba919540ec141a5991c0] => 1
    [name] => Rick Stoffiere
    [username] => REDACTED
    [email] => REDACTED@gmail.com
    [password] => 486762
    [password2] => 486762
    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 
                    [id] => 1763
                    [name] => Rick Stoffiere
                    [username] => REDACTED
                    [email] => REDACTED@gmail.com
                    [password] => 
                    [password_clear] => 486762
                    [block] => 
                    [sendEmail] => 0
                    [registerDate] => 2014-08-27 05:44:04
                    [lastvisitDate] => 
                    [activation] => 
                    [groups] => Array
                        (
                            [0] => 17
                        )

                    [lastResetTime] => 
                    [resetCount] => 
                    [requireReset] => 
                    [*_params] => Joomla\Registry\Registry Object
                        (
                            [data:protected] => stdClass Object
                                (
                                )

                        )

                    [*_authGroups] => Array
                        (
                            [0] => 1
                            [1] => 9
                        )

                    [*_authLevels] => Array
                        (
                            [0] => 1
                            [1] => 1
                            [2] => 5
                        )

                    [*_authActions] => 
                    [*_errorMsg] => 
                    [*_errors] => Array
                        (
                        )

                    [aid] => 0
                    [option] => com_chronoforms
                    [chronoform] => add_qualified_customer
                    [event] => submit
                    [user_firstname] => Rick
                    [user_lastname] => Stoffiere
                    [user_company] => The GRA Group
                    [user_email] => REDACTED@gmail.com
                    [user_fullname] => Rick Stoffiere
                    [user_username] => REDACTED
                    [user_password] => 486762
                    [user_password_verify] => 486762
                    [trv_trips] => 0
                    [input_submit_12] => CREATE USER
                    [e8f16bec71e4ba919540ec141a5991c0] => 1
                    [password2] => 486762
                    [usertype] => deprecated
                )

        )

)

Validation Errors:

Array
(
)

Debug Data

    email
        10
            Result An email has been SENT successfully from (Travel with Hirsch Pipe & Supply)mailsender@travelwithhirsch.com to rick@thegragroup.com
            Body

            A new user has been added to the travel registration system. Their login information follows:

            Full Name: Rick Stoffiere
            Company: The GRA Group
            Email: REDACTED@gmail.com
            Username: REDACTED
            Password: 486762


            Submitted by 70.62.204.42
            Attachments array ( )

momentis 05 Sep, 2014
Any ideas on this?
Max_admin 07 Sep, 2014
Answer
Please try to change this line:
$form->data['user_password'] = rand(100000,999999);

to
$form->data['user_password'] = (string)rand(100000,999999);


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.