Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reactivate twofactor_gateway #226

Closed
binford6000 opened this issue Apr 17, 2019 · 7 comments · Fixed by #232
Closed

Can't reactivate twofactor_gateway #226

binford6000 opened this issue Apr 17, 2019 · 7 comments · Fixed by #232

Comments

@binford6000
Copy link

I deactivated twofactor_gateway some days ago and wanted to reactivate it. When i enter my identification it says: "Could not verify your code. Please try again". This could be found in the log:

`[index] Error: UnexpectedValueException: Only integers, floats and strings are allowed as value at <>

  1. /var/www/cloud/apps/twofactor_gateway/lib/Service/Gateway/Telegram/Gateway.php line 107
    setUserValue("admin", "twofactor_gateway", "telegram_chat_id", null)
  2. /var/www/cloud/apps/twofactor_gateway/lib/Service/Gateway/Telegram/Gateway.php line 75
    getChatId(OC\User\User {}, Telegram\Bot\Api {}, 123456789)
  3. /var/www/cloud/apps/twofactor_gateway/lib/Service/SetupService.php line 92
    send(OC\User\User {}, "123456789", "253871 is your ... .")
  4. /var/www/cloud/apps/twofactor_gateway/lib/Controller/SettingsController.php line 90
    startSetup(OC\User\User {}, "telegram", "123456789")
  5. /var/www/cloud/lib/private/AppFramework/Http/Dispatcher.php line 166
    startVerification("telegram", "123456789")
  6. /var/www/cloud/lib/private/AppFramework/Http/Dispatcher.php line 99
    executeController(OCA\TwoFactorGat ... {}, "startVerification")
  7. /var/www/cloud/lib/private/AppFramework/App.php line 118
    dispatch(OCA\TwoFactorGat ... {}, "startVerification")
  8. /var/www/cloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    main("OCA\TwoFactorG ... r", "startVerification", OC\AppFramework\ ... {}, {gateway: "teleg ... "})
  9. <>
    __invoke({gateway: "teleg ... "})
  10. /var/www/cloud/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ ... {}, {gateway: "teleg ... "})
  11. /var/www/cloud/lib/base.php line 987
    match("/apps/twofactor ... t")
  12. /var/www/cloud/index.php line 42
    handleRequest()

POST /apps/twofactor_gateway/settings/telegram/verification/start
from 91.67.178.10 by admin at 2019-04-17T19:28:16+00:00`

What can i do to reactivate twofactor_gateway?
Kind regards,
Sebastian

@ChristophWurst
Copy link
Member

Apparently an invalid value type is passed as parameter. I assume it is null.

In the case of Telegram this is a bit of a problem because the /start message is only sent once.

@ChristophWurst
Copy link
Member

This won't help solving your issue but it's a known bug/limitation:

// TODO: handle missing `/start` message and `$update` null values

@ChristophWurst
Copy link
Member

This is likely related to #110. Unfortunately I have not found the time yet to work on that as this app is low on my priority list, so any help would be highly appreciated 🙌

@parreitu
Copy link

Hi
I've made a test. I've edited the getChatId function of this file

$chatId = $this->config->getUserValue($user->getUID(), 'twofactor_gateway', 'telegram_chat_id', null);

Replacing

$chatId = $this->config->getUserValue($user->getUID(), 'twofactor_gateway', 'telegram_chat_id', null);

by this line (suppose that 999999 is my chat_id)

$chatId = 999999

With this change, all is ok. I can configure the gateway, I get the verification code on my telegram APP , I can deactivate and activate again the twofactor_gateway, ..., all is OK.

All the problems related by @Dretech in this issue #110 appear to be solved.

So, in consequence, I think that the problem is in this line, it isn't getting the number (our chat_id) that we previously have introduced in the verify box

$chatId = $this->config->getUserValue($user->getUID(), 'twofactor_gateway', 'telegram_chat_id', null);

I don't know how to make this changes in PHP, but it could be a good clue to solve the issue.

@binford6000
Copy link
Author

Hi parreitu,
that works for me, too! Made my day ;-)
Sebastian

@Dretech
Copy link
Contributor

Dretech commented May 7, 2019

Hello Parreitu,

You found the cause why the Telegram 2fa app is not working in Nextcloud. When I change the chatid by the way you described, the app is working! Thanks.

@ChristophWurst can you change line 86 of /lib/Service/Gateway/Telegram/Gateway.php in a way that this line uses the user id entered in the web interface?

Dretech

@ChristophWurst
Copy link
Member

It's on my todo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants