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

add 2fa backup codes app #1171

Merged
merged 3 commits into from Sep 5, 2016

Conversation

Projects
None yet
7 participants
@ChristophWurst
Member

ChristophWurst commented Aug 29, 2016

integrates https://github.com/ChristophWurst/twofactor_backupcodes and fixes #1108

  • App is always enabled, so users can create backup codes even before an admin randomly enables/enforces a 2FA provider
  • Does not enforce 2FA is this app is the only active 2FA provider
  • Does not show up in the list of selectable 2FA providers
  • Adds a "Use backup code" link underneath the 2FA selection page and 2FA challenge page

TODO:

  • Unit/integration tests for the twofactor_backupcodes app
  • Fix/add tests for the changed server classes

bildschirmfoto von 2016-08-29 19-13-25

@nextcloud/designers any idea how we could make the settings dialog prettier? See the screenshots in https://github.com/ChristophWurst/twofactor_backupcodes for how it looks now.

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Aug 29, 2016

@ChristophWurst, thanks for your PR! By analyzing the annotation information on this pull request, we identified @bantu, @icewind1991 and @DeepDiver1975 to be potential reviewers

mention-bot commented Aug 29, 2016

@ChristophWurst, thanks for your PR! By analyzing the annotation information on this pull request, we identified @bantu, @icewind1991 and @DeepDiver1975 to be potential reviewers

Show outdated Hide outdated core/shipped.json Outdated
@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 2, 2016

Member
/usr/local/bin/phpunit --configuration phpunit-autotest.xml --exclude-group DB --log-junit autotest-results-sqlite.xml  
PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /drone/src/github.com/nextcloud/server/tests/Core/Command/Config/App/DeleteConfigTest.php on line 46
[info] build failed (exit code 255)

unrelated?

Member

ChristophWurst commented Sep 2, 2016

/usr/local/bin/phpunit --configuration phpunit-autotest.xml --exclude-group DB --log-junit autotest-results-sqlite.xml  
PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /drone/src/github.com/nextcloud/server/tests/Core/Command/Config/App/DeleteConfigTest.php on line 46
[info] build failed (exit code 255)

unrelated?

@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 2, 2016

Member

@rullzer @LukasReschke @nicohauger @zkwoob @Alphakilo @jancborchardt @Mar1u5 review and test this please.

The personal settings dialog definitely needs some UI/UX enhancements, that I'd like to postpone to follow-up PRs as this one is already rather big.

Member

ChristophWurst commented Sep 2, 2016

@rullzer @LukasReschke @nicohauger @zkwoob @Alphakilo @jancborchardt @Mar1u5 review and test this please.

The personal settings dialog definitely needs some UI/UX enhancements, that I'd like to postpone to follow-up PRs as this one is already rather big.

@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 2, 2016

Member

Does PHPUnit automatically find the test of the newly added app or do I have to register them somewhere?

Member

ChristophWurst commented Sep 2, 2016

Does PHPUnit automatically find the test of the newly added app or do I have to register them somewhere?

@MorrisJobke

This comment has been minimized.

Show comment
Hide comment
@MorrisJobke

MorrisJobke Sep 2, 2016

Member
$ NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
Using PHP executable /usr/bin/php
Parsing all files in lib/public for the presence of @since or @deprecated on each method...

Using database oc_autotest
Setup environment for sqlite testing on local storage ...
Installing ....
Nextcloud is not installed - only a limited number of commands are available
creating sqlite db
Nextcloud was successfully installed
Testing with sqlite ...
No coverage
/usr/local/bin/phpunit --configuration phpunit-autotest.xml --group DB --log-junit autotest-results-sqlite.xml  
PHPUnit 4.8.24 by Sebastian Bergmann and contributors.

Runtime:    PHP 5.6.22-0+deb8u1
Configuration:  /drone/src/github.com/nextcloud/server/tests/phpunit-autotest.xml
Warning:    Deprecated configuration setting "strict" used

........S....................................................   61 / 4240 (  1%)
PHP Fatal error:  Call to a member function getUpdater() on null in /drone/src/github.com/nextcloud/server/lib/private/Files/View.php on line 695
[info] build failed (exit code 255)
Member

MorrisJobke commented Sep 2, 2016

$ NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
Using PHP executable /usr/bin/php
Parsing all files in lib/public for the presence of @since or @deprecated on each method...

Using database oc_autotest
Setup environment for sqlite testing on local storage ...
Installing ....
Nextcloud is not installed - only a limited number of commands are available
creating sqlite db
Nextcloud was successfully installed
Testing with sqlite ...
No coverage
/usr/local/bin/phpunit --configuration phpunit-autotest.xml --group DB --log-junit autotest-results-sqlite.xml  
PHPUnit 4.8.24 by Sebastian Bergmann and contributors.

Runtime:    PHP 5.6.22-0+deb8u1
Configuration:  /drone/src/github.com/nextcloud/server/tests/phpunit-autotest.xml
Warning:    Deprecated configuration setting "strict" used

........S....................................................   61 / 4240 (  1%)
PHP Fatal error:  Call to a member function getUpdater() on null in /drone/src/github.com/nextcloud/server/lib/private/Files/View.php on line 695
[info] build failed (exit code 255)
@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 2, 2016

Member

let me try to reproduce the failing tests locally…

Member

ChristophWurst commented Sep 2, 2016

let me try to reproduce the failing tests locally…

@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 2, 2016

Member

@MorrisJobke what are the requirements/preconditions to run all tests locally? I get Tests: 4716, Assertions: 12160, Errors: 1359, Failures: 13, Skipped: 286. :-(

Member

ChristophWurst commented Sep 2, 2016

@MorrisJobke what are the requirements/preconditions to run all tests locally? I get Tests: 4716, Assertions: 12160, Errors: 1359, Failures: 13, Skipped: 286. :-(

@MorrisJobke

This comment has been minimized.

Show comment
Hide comment
@MorrisJobke

MorrisJobke Sep 2, 2016

Member

@MorrisJobke what are the requirements/preconditions to run all tests locally?

drone exec

(see http://readme.drone.io/devs/cli/)

Best is also to remove the running tests from .drone.yml this speeds up the test execution ;)

Member

MorrisJobke commented Sep 2, 2016

@MorrisJobke what are the requirements/preconditions to run all tests locally?

drone exec

(see http://readme.drone.io/devs/cli/)

Best is also to remove the running tests from .drone.yml this speeds up the test execution ;)

@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 2, 2016

Member

stack trace:

Call to a member function getUpdater() on null in /server/lib/private/Files/View.php on line 696
#0  OC\Files\View->unlink() called at [/server/lib/private/Cache/File.php:146]
#1  OC\Cache\File->remove() called at [/server/tests/lib/Cache/FileCacheTest.php:91]
#2  Test\Cache\FileCacheTest->tearDown() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:805]
#3  PHPUnit_Framework_TestCase->runBare() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php:612]
#4  PHPUnit_Framework_TestResult->run() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:724]
#5  PHPUnit_Framework_TestCase->run() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php:747]
#6  PHPUnit_Framework_TestSuite->run() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php:747]
#7  PHPUnit_Framework_TestSuite->run() called at [phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php:440]
#8  PHPUnit_TextUI_TestRunner->doRun() called at [phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:149]
#9  PHPUnit_TextUI_Command->run() called at [phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:100]
#10 PHPUnit_TextUI_Command::main() called at [/usr/local/bin/phpunit:548]
Member

ChristophWurst commented Sep 2, 2016

stack trace:

Call to a member function getUpdater() on null in /server/lib/private/Files/View.php on line 696
#0  OC\Files\View->unlink() called at [/server/lib/private/Cache/File.php:146]
#1  OC\Cache\File->remove() called at [/server/tests/lib/Cache/FileCacheTest.php:91]
#2  Test\Cache\FileCacheTest->tearDown() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:805]
#3  PHPUnit_Framework_TestCase->runBare() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php:612]
#4  PHPUnit_Framework_TestResult->run() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:724]
#5  PHPUnit_Framework_TestCase->run() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php:747]
#6  PHPUnit_Framework_TestSuite->run() called at [phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php:747]
#7  PHPUnit_Framework_TestSuite->run() called at [phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php:440]
#8  PHPUnit_TextUI_TestRunner->doRun() called at [phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:149]
#9  PHPUnit_TextUI_Command->run() called at [phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:100]
#10 PHPUnit_TextUI_Command::main() called at [/usr/local/bin/phpunit:548]

ChristophWurst added some commits Aug 29, 2016

add 2fa backup codes app
* add backup codes app unit tests
* add integration tests for the backup codes app
@rullzer

This comment has been minimized.

Show comment
Hide comment
@rullzer

rullzer Sep 5, 2016

Member

Some dark magic. Seems something was not cleaned up properly or so which caused the whole thing to break down.

CI seems a lot happier now ;)

Member

rullzer commented Sep 5, 2016

Some dark magic. Seems something was not cleaned up properly or so which caused the whole thing to break down.

CI seems a lot happier now ;)

@ChristophWurst

This comment has been minimized.

Show comment
Hide comment
@ChristophWurst

ChristophWurst Sep 5, 2016

Member

Thank you very much @rullzer 🚀

Member

ChristophWurst commented Sep 5, 2016

Thank you very much @rullzer 🚀

@rullzer

This comment has been minimized.

Show comment
Hide comment
@rullzer

rullzer Sep 5, 2016

Member

CI happy.
Tested in combination with TOTP and worked like a charm.
Code looks good! LGTM!

Member

rullzer commented Sep 5, 2016

CI happy.
Tested in combination with TOTP and worked like a charm.
Code looks good! LGTM!

@MariusBluem

This comment has been minimized.

Show comment
Hide comment
@MariusBluem

MariusBluem Sep 5, 2016

Member

Works 👍

Member

MariusBluem commented Sep 5, 2016

Works 👍

@MariusBluem MariusBluem merged commit f8eb7be into master Sep 5, 2016

4 checks passed

Scrutinizer 13 new issues, 26 updated code elements
Details
approvals/lgtm this commit looks good
continuous-integration/drone the build was successful
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@MariusBluem MariusBluem deleted the 2fa-backup-codes branch Sep 5, 2016

<licence>agpl</licence>
<author>Christoph Wurst</author>
<version>1.0.0</version>
<namespace>TwoFactor_BackupCodes</namespace>

This comment has been minimized.

@nickvergessen

nickvergessen Sep 5, 2016

Member

Please, no underscores in PSR-4 Namespaces

@nickvergessen

nickvergessen Sep 5, 2016

Member

Please, no underscores in PSR-4 Namespaces

},
_onPrintBackupCodes: function () {
var url = this._getDownloadDataHref();
window.open(url, 'Nextcloud backpu codes');

This comment has been minimized.

@nickvergessen
@nickvergessen

nickvergessen Sep 5, 2016

Member

🙈

This comment has been minimized.

@nickvergessen

nickvergessen Sep 5, 2016

Member

the typo I mean

@nickvergessen

nickvergessen Sep 5, 2016

Member

the typo I mean

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