Skip to content

print the backup codes tab and not the current one - #2704

Merged
rullzer merged 2 commits into
masterfrom
2fa-fix-backup-codes-print
Feb 15, 2017
Merged

print the backup codes tab and not the current one#2704
rullzer merged 2 commits into
masterfrom
2fa-fix-backup-codes-print

Conversation

@ChristophWurst

Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
Member

please backport 👍

@nickvergessen

Copy link
Copy Markdown
Member

Doesn't work here with FF:
mozilla.pdf

@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

Doesn't work here with FF:
mozilla.pdf

Works here with 50.1.0 🤔

@ChristophWurst

ChristophWurst commented Dec 15, 2016

Copy link
Copy Markdown
MemberAuthor

Ouch. Doesn't work on Chromium either.

@ChristophWurstChristophWurst added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 15, 2016
@ChristophWurst
ChristophWurstforce-pushed the 2fa-fix-backup-codes-print branch from 6bc4b09 to f86c71bCompareDecember 19, 2016 12:48
@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

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 😁

@ChristophWurstChristophWurst 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
Copy Markdown
MemberAuthor

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
ChristophWurstforce-pushed the 2fa-fix-backup-codes-print branch from 8fb43ce to 3295fe2CompareJanuary 17, 2017 09:32
@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

rebased

@codecov-io

Copy link
Copy Markdown

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

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@MorrisJobke

Copy link
Copy Markdown
Member

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

Ping

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

Copy link
Copy Markdown
Member

@ChristophWurst Please open a backport PR ;)

@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

@ChristophWurst Please open a backport PR ;)

Done: #3510 :-)

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

Labels

3. to reviewWaiting for reviewsbug

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.

7 participants

@ChristophWurst@mention-bot@karlitschek@nickvergessen@codecov-io@MorrisJobke@rullzer