Jump to content
  • 0

The password must be at least 5 characters in length


hpno

Question

I am migrating an account from a DirectAdmin server to another. But after choosing the new server and clicked Save button, Blesta shows error: The password must be at least 5 characters in length

Which password then? Both servers have long passwords. That user has a long password.

Advice, please?

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 0

direct_admin.php defines a minLength of 5 for the direct_admin_password. Search ~/components/modules/direct_admin/direct_admin.php for "minLength", and you'll see a value of 5. You could try decreasing this temporarily to say 1 and see if that allows you to change the server. When finished, I'd suggest changing the value back.

Link to comment
Share on other sites

  • 0

Try changing it to 0. The error message will be the same regardless of the minLength, but this is the only location within the directadmin module that sets a requirement of 5.. so this must be it. Otherwise, it's your DA server returning the error, but I doubt it. (You could confirm by checking the module log Tools > Logs > Module Log)

When you edit the service, do you see the password asterisked out in the password field? ************ If this field is empty, it explains the error.

Link to comment
Share on other sites

  • 0

I'm assuming this occurs occurs on the admin/clients/editservice/ page.  The error is based on the password entered in that form.   Likely you will want to keep the same password, which should be auto-populated into the field, in plain text as you said.  This password should also be shown under the expanded row in the client services widget.   If you remove the value from this password field then you will get an error.  Are you removing that value?

Link to comment
Share on other sites

  • 0
2 hours ago, Jono said:

I'm assuming this occurs occurs on the admin/clients/editservice/ page.  The error is based on the password entered in that form.   Likely you will want to keep the same password, which should be auto-populated into the field, in plain text as you said.  This password should also be shown under the expanded row in the client services widget.   If you remove the value from this password field then you will get an error.  Are you removing that value?

No, I didn't remove anything. All I did was changing the servers, and clicking to Save button then the error appeared.

Link to comment
Share on other sites

  • 0
1 hour ago, Jono said:

Hmm, well as I said, there shouldn't be any way for this to occur unless the value in that field is less than 5 characters long.  Let me know if this comes up again and I'll take another look.

See the attached file, unless we are talking about different places.

da.jpg

Link to comment
Share on other sites

  • 0

CORE-2458.  If you want to fix this in your code replace direct_admin.php lines 1267-1276

            'direct_admin_password' => [
                'format' => [
                    'rule' => ['matches', "/^[(\x20-\x7F)]*$/"], // ASCII 32-127
                    'message' => Language::_('DirectAdmin.!error.direct_admin_password.format', true)
                ],
                'length' => [
                    'rule' => ['minLength', 5],
                    'message' => Language::_('DirectAdmin.!error.direct_admin_password.length', true)
                ]
            ],

with

            'direct_admin_password' => [
                'format' => [
                    'if_set' => $edit,
                    'rule' => ['matches', "/^[(\x20-\x7F)]*$/"], // ASCII 32-127
                    'message' => Language::_('DirectAdmin.!error.direct_admin_password.format', true)
                ],
                'length' => [
                    'if_set' => $edit,
                    'rule' => ['minLength', 5],
                    'message' => Language::_('DirectAdmin.!error.direct_admin_password.length', true)
                ]
            ],

 

Link to comment
Share on other sites

  • 0
21 hours ago, phamhung said:

Now I can change the server. However, after changing server, the user password, as I showed above, disappeared. It's blank now.

Right you are.  It looks like the change is only made locally.  It seems that if no password is given in the edit, it defaults to a blank value.  To fix this you can replace lines 1043-1049

        $params = [
            'username' => isset($service_fields->direct_admin_username)
                ? $service_fields->direct_admin_username
                : '',
            'passwd' => isset($vars['direct_admin_password']) ? $vars['direct_admin_password'] : '',
            'passwd2' => isset($vars['direct_admin_password']) ? $vars['direct_admin_password'] : '',
        ];

with

        $params = [
            'username' => isset($service_fields->direct_admin_username)
                ? $service_fields->direct_admin_username
                : '',
            'passwd' => isset($vars['direct_admin_password'])
                ? $vars['direct_admin_password']
                : (
                    isset($service_fields->direct_admin_password)
                        ? $service_fields->direct_admin_password
                        : ''
                ),
            'passwd2' => isset($vars['direct_admin_password'])
                ? $vars['direct_admin_password']
                : (
                    isset($service_fields->direct_admin_password)
                        ? $service_fields->direct_admin_password
                        : ''
        ]

Thereby causing it to maintain the current password by default.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...