matteo-convertino / otpmanager-nextcloud

Nextcloud app that allows you to manage your OTP (TOTP/HOTP) codes easily
GNU Affero General Public License v3.0
25 stars 5 forks source link

Error on adding first OTP via app #21

Closed beatles1 closed 7 months ago

beatles1 commented 7 months ago

Hi, this project looks great, just what I want (especially as it looks like a Firefox extension is on the way).

However I'm having an error as soon as I add my first OTP in the app. Basically I can login fine but when I scan a QR to add the first token the server responds with a 500 error. It then gets the same every time I open the app until I log out and back in at which point I have nothing in there again.

I've checked the server logs and it appears it's because "Field 'digits' doesn't have a default value". Trace log entry from the server below, I can provide the full raw long via a private message if required.

[index] Error: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'digits' doesn't have a default value POST /index.php/apps/otpmanager/accounts/sync from by at 19 Jan 2024, 16:35:45

/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.phpline 328

OC\DB\Exceptions\DbalException::wrap(
  [
    "Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException"
  ]
)

/var/www/html/lib/public/AppFramework/Db/QBMapper.phpline 137

OC\DB\QueryBuilder\QueryBuilder->executeStatement()

/var/www/html/custom_apps/otpmanager/lib/Controller/AccountController.phpline 318

OCP\AppFramework\Db\QBMapper->insert(
  [
    "OCA\\OtpManager\\Db\\Account",
    null
  ]
)

/var/www/html/custom_apps/otpmanager/lib/Controller/AccountController.phpline 383

OCA\OtpManager\Controller\AccountController->compareAccounts(
  "*** sensitive parameters replaced ***"
)

/var/www/html/lib/private/AppFramework/Http/Dispatcher.phpline 230

OCA\OtpManager\Controller\AccountController->sync(
  "*** sensitive parameters replaced ***"
)

/var/www/html/lib/private/AppFramework/Http/Dispatcher.phpline 137

OC\AppFramework\Http\Dispatcher->executeController(
  [
    "OCA\\OtpManager\\Controller\\AccountController"
  ],
  "sync"
)

/var/www/html/lib/private/AppFramework/App.phpline 184

OC\AppFramework\Http\Dispatcher->dispatch(
  [
    "OCA\\OtpManager\\Controller\\AccountController"
  ],
  "sync"
)

/var/www/html/lib/private/Route/Router.phpline 315

OC\AppFramework\App::main(
  "OCA\\OtpManager\\Controller\\AccountController",
  "sync",
  [
    "OC\\AppFramework\\DependencyInjection\\DIContainer"
  ],
  [
    "otpmanager.account.sync"
  ]
)

/var/www/html/lib/base.phpline 1069

OC\Route\Router->match(
  "/apps/otpmanager/accounts/sync"
)

/var/www/html/index.phpline 39

OC::handleRequest()
matteo-convertino commented 7 months ago

Thank you so much for pointing this out to me. Now I'm trying to reproduce the error so I can understand what it depends on. To be sure: is the account you scanned a TOTP or HOTP type?

beatles1 commented 7 months ago

Thanks for the super quick reply. Both I tested were TOTP. One was GitHub and one was the page at https://authenticationtest.com/totpChallenge/

For reference I installed it today and my Nextcloud server is 28.0.1

matteo-convertino commented 7 months ago

I just released a new release where the problem should be fixed. It takes quite a few hours for the update to arrive on the Play Store, so if you want you can download the apk directly from the release on Github.

beatles1 commented 7 months ago

Unfortunately currently I'm blocked from installing apps from other sources on my device. It doesn't seem to have updated on the Play Store yet but possibly it'll take a while for Google to review because of the weekend.

beatles1 commented 7 months ago

I can now confirm this has updated in Google Play and the issue is resolved