Jump to content
  • 0
phamhung

The password must be at least 5 characters in length

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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
  • 0

No, module log doesn't record anything when I clicked Save button in changing server.

And for editing service, do you mean that editing customer's service in customer page? Under Manage link? Then the password is shown as normal-readable text, not marked with *********

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
  • 0

Hi I think the best way Linux typing the password as non-visible text.

Create Passwords:

  • Password Length:
  • Include Letters:
  • Include Mixed Case:
  • Include Numbers:
  • Include Punctuation:
  • No Similar characters:

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
  • 0

As long as that value is 5 characters or longer when you submit the form, the error should not occur.  Have you been able to recreate this since the first time?

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, Jono said:

As long as that value is 5 characters or longer when you submit the form, the error should not occur.  Have you been able to recreate this since the first time?

Yes, since the first time I tried to change the server.

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
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

Share this post


Link to post
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)
                ]
            ],

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×