twofactor_gateway icon indicating copy to clipboard operation
twofactor_gateway copied to clipboard

PlaySMS configuration is not working

Open EasyNetDev opened this issue 4 years ago • 3 comments

Hi,

I've tried this app for NextCloud 20.0.5, but after selecting playsms as SMS provider and adding URL, user and pass I go an error:

sudo -u www-data php /var/www/nextcloud/occ twofactorauth:gateway:configure sms
Please choose a SMS provider (websms, playsms, clockworksms, puzzelsms, ecallsms, voipms, huawei_e3531, spryng, sms77io, ovh, clickatellcentral, clicksend): playsms
Please enter your PlaySMS URL: https://playsms.MyDomain.com
Please enter your PlaySMS username: YYYYYYYYY
Please enter your PlaySMS password: XXXXXXXXXXXXXXXXXXX
An unhandled exception has been thrown:
TypeError: Return value of "OCA\TwoFactorGateway\Command\Configure::execute()" must be of the type int, "null" returned. in /var/www/nextcloud/apps/mail/vendor/symfony/console/Command/Command.php:261
Stack trace:
#0 /var/www/nextcloud/apps/mail/vendor/symfony/console/Application.php(920): Symfony\Component\Console\Command\Command->run()
#1 /var/www/nextcloud/apps/mail/vendor/symfony/console/Application.php(266): Symfony\Component\Console\Application->doRunCommand()
#2 /var/www/nextcloud/apps/mail/vendor/symfony/console/Application.php(142): Symfony\Component\Console\Application->doRun()
#3 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#4 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#5 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#6 {main}root@NextCloud-01:/var/www/nextcloud# mcedit /var/www/nextcloud/apps/mail/vendor/symfony/console/Command/Command.php

Also for PlaySMS I know that is necessary a hash to access the platform.

EasyNetDev avatar Jan 19 '21 11:01 EasyNetDev

The Configure command has to return an int from all paths.

ChristophWurst avatar Jan 19 '21 11:01 ChristophWurst

Hi,

Checking the code I'm noticing this:

    /**
     * Executes the current command.
     *
     * This method is not abstract because you can use this class
     * as a concrete class. In this case, instead of defining the
     * execute() method, you set the code to execute by passing
     * a Closure to the setCode() method.
     *
     * @return int 0 if everything went fine, or an exit code
     *
     * @throws LogicException When this abstract method is not implemented
     *
     * @see setCode()
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        throw new LogicException('You must override the execute() method in the concrete command class.');
    }

This function is extremely simple function and it doesn't return anything.

EasyNetDev avatar Jan 19 '21 11:01 EasyNetDev

@return int 0 if everything went fine, or an exit code

Here you go. This is documented behavior in Symfony 4.4 if you don't trust me.

ChristophWurst avatar Jan 27 '21 18:01 ChristophWurst