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

Exception when entering OTP code more than 16 characters

    Details

      Description

      When submitting a one time password during the 2FA check that is longer than 16 characters, an error is returned:

      String data, right truncated: 1406 Data too long for column 'otp' at row 1 on line 196 .../path/to/PdoConnection.php

      User input should not exceed 16 characters. The reporter of this bug included the following diff for our consideration:

      diff --git a/blesta/app/models/users.php b/blesta/app/models/users.php
      index 3b6fa517..75e4ec57 100644
      — a/blesta/app/models/users.php
      +++ b/blesta/app/models/users.php
      @@ -66,6 +66,11 @@ class Users extends AppModel
      // Validate OTP
      $rules = [
      'otp' => [
      + 'valid' => [
      + 'rule' => ['maxLength', 16],
      + 'message' => $this->_('Users.!error.otp.auth'),
      + 'final' => true
      + ],
      'auth' => [
      'rule' => [[$this, 'validateOtp'], $user],
      'message' => $this->_('Users.!error.otp.auth')
      @@ -986,6 +991,11 @@ class Users extends AppModel

      // Validate OTP
      $rules['otp'] = [
      + 'valid' => [
      + 'rule' => ['maxLength', 16],
      + 'message' => $this->_('Users.!error.otp.auth'),
      + 'final' => true
      + ],
      'auth' => [
      'rule' => [[$this, 'validateOtp'], $user],
      'message' => $this->_('Users.!error.otp.auth')

        Activity

        admin Paul Phillips created issue -
        admin Paul Phillips made changes -
        Field Original Value New Value
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Sprint 5.1.0 Sprint 3 [ 127 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Assignee Jonathan Reissmueller [ jonathan ]
        jonathan Jonathan Reissmueller made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Progress [ 3 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 25 minutes [ 1500 ]
        Worklog Id 14804 [ 14804 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              5/Apr/21

              Time Tracking

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

                Agile