Skip to content

Conversation

@ChristophWurst
Copy link
Member

Fixes #2662

Before, the current tab was printed (and closed), not the temporary one with the backup codes.

Should be backported IMO. cc @karlitschek

@mention-bot
Copy link

@ChristophWurst, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen to be a potential reviewer.

@karlitschek
Copy link
Member

please backport 👍

@nickvergessen
Copy link
Member

Doesn't work here with FF:
mozilla.pdf

@ChristophWurst
Copy link
Member Author

Doesn't work here with FF:
mozilla.pdf

Works here with 50.1.0 🤔

@ChristophWurst
Copy link
Member Author

ChristophWurst commented Dec 15, 2016

Ouch. Doesn't work on Chromium either.

@ChristophWurst ChristophWurst added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 15, 2016
@ChristophWurst ChristophWurst force-pushed the 2fa-fix-backup-codes-print branch from 6bc4b09 to f86c71b Compare December 19, 2016 12:48
@ChristophWurst
Copy link
Member Author

For some reason Chrome doesn't allow the "old" approach anymore, it closes the tab immediately if a data url is used. Now I'm using the window object to write to its document. Apparently that works on all browsers I have tested:

  • FF 50
  • Chromium (default settings, e.g. pop-ups are blocked)
  • Gnome Web

I don't have IE nor Safari, we should test those too as I'm not too confident that it works everywhere. Maybe @MorrisJobke or @LukasReschke can help here 😁

@ChristophWurst ChristophWurst added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 20, 2016
var data = this._getDownloadData();
var newTab = window.open('', t('twofactor_backupcodes', 'Nextcloud backup codes'));
newTab.document.write('<h1>' + t('twofactor_backupcodes', 'Nextcloud backup codes') + '</h1>');
newTab.document.write(data);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @LukasReschke for possible security implications of writing to the document directly

… codes

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst force-pushed the 2fa-fix-backup-codes-print branch from 8fb43ce to 3295fe2 Compare January 17, 2017 09:32
@ChristophWurst
Copy link
Member Author

rebased

@codecov-io
Copy link

Current coverage is 53.92% (diff: 100%)

Merging #2704 into master will not change coverage

@@             master      #2704   diff @@
==========================================
  Files          1302       1302          
  Lines         80097      80097          
  Methods        7905       7905          
  Messages          0          0          
  Branches       1245       1245          
==========================================
  Hits          43189      43189          
  Misses        36908      36908          
  Partials          0          0          

Powered by Codecov. Last update b1a8296...3295fe2

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works with Firefox, Safari and Chrome 👍

@MorrisJobke
Copy link
Member

@nickvergessen @rullzer @schiessle @LukasReschke Mind to review this one?

@MorrisJobke
Copy link
Member

@nickvergessen @rullzer @schiessle @LukasReschke Mind to review this one?

Ping

@rullzer rullzer merged commit 2d8b7b8 into master Feb 15, 2017
@rullzer rullzer deleted the 2fa-fix-backup-codes-print branch February 15, 2017 19:18
@MorrisJobke
Copy link
Member

@ChristophWurst Please open a backport PR ;)

@ChristophWurst
Copy link
Member Author

@ChristophWurst Please open a backport PR ;)

Done: #3510 :-)

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

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NC11.0.0: Printing backup codes fails when Adblock Plus is activated, ABP prevents the new window for printing the backup codes to be opened.

8 participants