Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-4521

Vesta: Username generation fails to prevent conflicts

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.1
    • Component/s: None
    • Labels:
      None

      Description

      https://github.com/blesta/module-vesta/issues/17

      To reproduce:

      • Create a Vesta service for hostdomain.com
      • Try to create a Vesta service for hostdomaine.com
      • Receive error
      • Check module logs
      • See error "Error: user hostdom0 exists"

      To resolve, update vesta.php around line 1345 from

              if (isset($user['status']) && $user['status']) {
                  for ($i = 0; $i < (int) str_repeat(9, $account_matching_characters); $i++) {
                      $new_username = substr($username, 0, -strlen($i)) . $i;
      
                      $user = $vesta->getAccountsUsage($new_username);
                      if (isset($user['status']) && $user['status']) {
                          $username = $new_username;
                          break;
                      }
                  }
              }
      

      to

              if (isset($user['status']) && $user['status'] == 'true') {
                  for ($i = 0; $i < (int) str_repeat(9, $account_matching_characters); $i++) {
                      $new_username = substr($username, 0, -strlen($i)) . $i;
      
                      $user = $vesta->getAccountsUsage($new_username);
                      if (isset($user['status']) && $user['status'] == 'false') {
                          $username = $new_username;
                          break;
                      }
                  }
              }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            jonathan Jonathan Reissmueller
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              2/Nov/21

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 45 minutes
              45m

                Agile