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

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Sprint 5.3.0 Sprint 3 [ 143 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked lower
        jonathan Jonathan Reissmueller made changes -
        Fix Version/s 5.2.1 [ 11720 ]
        Fix Version/s 5.3.0-b1 [ 11711 ]
        Assignee Jonathan Reissmueller [ jonathan ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Status Open [ 1 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 45 minutes [ 2700 ]
        Worklog Id 15360 [ 15360 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          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