-
Notifications
You must be signed in to change notification settings - Fork 398
Add QR Code pushes #3418
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
Merged
Merged
Add QR Code pushes #3418
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
80d0c8d
Add QR Code pushes
ozovalihasan 996b1a6
Fix the length in the qr code form
ozovalihasan de2863e
Add tests for QR Code pushes
ozovalihasan 354e2dc
Update settings for qr codes
ozovalihasan a35196f
Add a comment for QR pushes
ozovalihasan fc83115
Add more routes for unified API controllers used for pushes
ozovalihasan 8c1b446
Add a locale for max length of qr pushes
ozovalihasan 8824d12
Remove an unnecessary space from config file of settings
ozovalihasan 31e67f5
Fix a test of QR pushes
ozovalihasan 930e342
Update the words used for QR code pushes
ozovalihasan f952816
Remove an unnecessary method defined before
ozovalihasan 760d2ad
Remove an unnecessary action of PushesController
ozovalihasan 49f17cc
Update a class used to get its attribute name
ozovalihasan f7f3348
Fix url helpers usage for tests of QR code pushes
ozovalihasan 1470767
Fix an if condition used in show view of PushesController
ozovalihasan ca3d3c7
Merge branch 'master' into add-qr-pushes
pglombardo 56bb631
Fix a few texts of a new qr push form
ozovalihasan 77d558e
Update a cookie key used to save settings of new qr push form
ozovalihasan 373569d
Merge branch 'master' into add-qr-pushes
pglombardo fd42c5a
Update tests to follow recent dashboard updates
pglombardo bef8cec
Remove an unnecessary import
ozovalihasan 4d78105
Fix indentations of a view
ozovalihasan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
<% title(_('Securely Send a Password')) %> | ||
|
||
<div class='container' | ||
data-controller="knobs pwgen passwords form" | ||
data-knobs-tab-name-value="password" | ||
data-knobs-lang-day-value="<%= _('Day') %>" | ||
data-knobs-lang-days-value="<%= _('Days') %>" | ||
data-knobs-default-days-value="<%= @push.settings_for_kind.expire_after_days_default %>" | ||
data-knobs-lang-view-value="<%= _('View') %>" | ||
data-knobs-lang-views-value="<%= _('Views') %>" | ||
data-knobs-default-views-value="<%= @push.settings_for_kind.expire_after_views_default %>" | ||
data-knobs-lang-save-value="<%= _('Save') %>" | ||
data-knobs-lang-saved-value="<%= _('Saved!') %>" | ||
data-knobs-default-retrieval-step-value="<%= @push.settings_for_kind.retrieval_step_default %>" | ||
data-knobs-default-deletable-by-viewer-value="<%= @push.settings_for_kind.deletable_pushes_default %>" | ||
data-pwgen-use-numbers-default-value="<%= Settings.gen.has_numbers %>" | ||
data-pwgen-title-cased-default-value="<%= Settings.gen.title_cased %>" | ||
data-pwgen-use-separators-default-value="<%= Settings.gen.use_separators %>" | ||
data-pwgen-consonants-default-value="<%= Settings.gen.consonants %>" | ||
data-pwgen-vowels-default-value="<%= Settings.gen.vowels %>" | ||
data-pwgen-separators-default-value="<%= Settings.gen.separators %>" | ||
data-pwgen-min-syllable-length-default-value="<%= Settings.gen.min_syllable_length %>" | ||
data-pwgen-max-syllable-length-default-value="<%= Settings.gen.max_syllable_length %>" | ||
data-pwgen-syllables-count-default-value="<%= Settings.gen.syllables_count %>" | ||
data-knobs-ga-enabled-value="<%= ENV.key?('GA_ENABLE') %>"> | ||
<%= render partial: "shared/topnav" %> | ||
<%= form_for @push, data: { action: 'form#submit' } do |f| %> | ||
<%= f.hidden_field :kind, value: :qr %> | ||
|
||
<div class='row'> | ||
<div class='col'> | ||
<%= f.text_area(:payload, { class: "form-control", | ||
rows: 4, | ||
placeholder: _('Enter the Password or Text to push...'), | ||
autocomplete: "off", | ||
spellcheck: "false", | ||
maxlength: 1024, | ||
autofocus: true, | ||
required: true, | ||
"data-pwgen-target" => "payloadInput", | ||
"data-passwords-target" => "payloadInput", | ||
"data-action" => "input->passwords#updateCharacterCount" | ||
}) %> | ||
<div class='position-relative'> | ||
<div id="the-count" class="position-absolute bottom-0 end-0 m-2 px-3 opacity-75"> | ||
<span id="current" data-passwords-target="currentChars">0</span> | ||
<span id="maximum" data-passwords-target="maximumChars">/ 1024 <%= _('Characters') %></span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class='row'> | ||
<div class='col-12 col-sm-8 p-3'> | ||
<div class='row'> | ||
<div><%= _('Expire secret link and delete after:') %></div> | ||
<div class='col-10'> | ||
<%= range_field_tag("push_expire_after_days", @push.settings_for_kind.expire_after_days_default, | ||
{ :name => "push[expire_after_days]", | ||
:class => "form-range", | ||
:min => @push.settings_for_kind.expire_after_days_min, | ||
:max => @push.settings_for_kind.expire_after_days_max, | ||
:step => "1", | ||
"data-action" => "change->knobs#updateDaysSlider input->knobs#updateDaysSlider", | ||
"data-knobs-target" => "daysRange" | ||
}) %> | ||
</div> | ||
<div class='col-2'> | ||
<div class="form-text" data-knobs-target="daysRangeLabel"><%= @push.settings_for_kind.expire_after_days_default %> <%= _('Days') %></div> | ||
</div> | ||
</div> | ||
<div class='row'> | ||
<div class='col-10'> | ||
<%= range_field_tag("push_expire_after_views", @push.settings_for_kind.expire_after_views_default, | ||
{ :name => "push[expire_after_views]", | ||
:class => "form-range", | ||
:min => @push.settings_for_kind.expire_after_views_min, | ||
:max => @push.settings_for_kind.expire_after_views_max, | ||
:step => "1", | ||
"data-action" => "change->knobs#updateViewsSlider input->knobs#updateViewsSlider", | ||
"data-knobs-target" => "viewsRange" | ||
}) %> | ||
</div> | ||
|
||
<div class='col-2'> | ||
<div class="form-text" data-knobs-target="viewsRangeLabel"><%= @push.settings_for_kind.expire_after_views_default %> <%= _('Views') %></div> | ||
</div> | ||
</div> | ||
<div class='row'> | ||
<div class='col'> | ||
<p class='text-center form-text'><%= _('(whichever comes first)') %></p> | ||
</div> | ||
</div> | ||
|
||
<div class='row mb-3'> | ||
<div class='col'> | ||
<div class="list-group mx-0"> | ||
<% if @push.settings_for_kind.enable_retrieval_step %> | ||
<label class="list-group-item d-flex gap-2"> | ||
<%= check_box_tag "push[retrieval_step]", nil, @push.settings_for_kind.retrieval_step_default, | ||
{ class: 'form-check-input flex-shrink-0', | ||
"data-knobs-target" => "retrievalStepCheckbox" } %> | ||
<span> | ||
<%= _('Use a 1-click retrieval step') %> | ||
<small class="d-block text-muted"><%= _('Helps to avoid chat systems and URL scanners from eating up views.') %></small> | ||
</span> | ||
</label> | ||
<% end %> | ||
<% if @push.settings_for_kind.enable_deletable_pushes %> | ||
<label class="list-group-item d-flex gap-2"> | ||
<%= check_box_tag "push[deletable_by_viewer]", nil, @push.settings_for_kind.deletable_pushes_default, | ||
{ class: 'form-check-input flex-shrink-0', | ||
"data-knobs-target" => "deletableByViewerCheckbox" } %> | ||
<span> | ||
<%= _('Allow immediate deletion') %> | ||
<small class="d-block text-muted"><%= _('Allow users to delete this push once retrieved.') %></small> | ||
</span> | ||
</label> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<div class='row mb-3'> | ||
<div class='col'> | ||
<div class="input-group"> | ||
<span class="input-group-text"><%= _('Passphrase Lockdown') %></span> | ||
<%= f.text_field(:passphrase, { class: "form-control", | ||
autocomplete: "off", | ||
placeholder: _('Optional: Require recipients to enter a passphrase to view this push') }) %> | ||
</div> | ||
</div> | ||
</div> | ||
<div class='row'> | ||
<div class='col'> | ||
<p class='mb-3'> | ||
<div id='cookie-save'> | ||
<a data-action="click->knobs#saveSettings" href="#"><%= _('Save') %></a> <%= _('the above settings as the page default.') %> | ||
</div> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class='col-12 col-sm-4 p-3 mt-3'> | ||
<div class="row mb-3"> | ||
<div class="btn-group mb-3" role="group" aria-label="Password Generator button group with nested dropdown"> | ||
<button class="btn btn-secondary w-75" type="button" | ||
id='generate_password' | ||
data-knobs-target="generatePasswordButton" | ||
data-action="pwgen#producePassword passwords#updateCharacterCount"><em class="bi bi-cpu"></em> <%= _('Generate Password') %></button> | ||
<button class="btn btn-secondary" type="button" id='configure_generator' | ||
data-action="pwgen#configureGenerator" | ||
data-bs-toggle="modal" data-bs-target="#configureModal"> | ||
<em class="bi bi-gear"></em> | ||
</button> | ||
</div> | ||
<p class='fst-italic fw-light'><%= _('Use the button above to generate a random password.') %></p> | ||
</div> | ||
<% if user_signed_in? %> | ||
<div class='row mb-3'> | ||
<div class="input-group"> | ||
<span class="input-group-text"><%= Password.human_attribute_name(:name) %></span> | ||
<%= f.text_field(:name, { class: "form-control", | ||
placeholder: _('Optional'), | ||
autocomplete: "off" }) %> | ||
</div> | ||
<div class="form-text" id="basic-addon4"><%= _('A name shown in the dashboard, notifications and emails.') %></div> | ||
</div> | ||
<div class='row mb-3'> | ||
<div class="input-group"> | ||
<span class="input-group-text"><%= _('Reference Note') %></span> | ||
<%= f.text_area(:note, { class: "form-control", | ||
rows: 1, | ||
placeholder: _('Optional'), | ||
autocomplete: "off" }) %> | ||
</div> | ||
<div class="form-text" id="basic-addon4"><%= _('Encrypted and visible only to you') %></div> | ||
</div> | ||
<% end %> | ||
<div class='row my-3 px-5'> <hr> </div> | ||
<div class='row mb-3'> | ||
<p class='fst-italic'><%= _('Tip: Only enter a password into the box. Other identifying information can compromise security.') %></p> | ||
ozovalihasan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<p class='fst-italic fw-light'><%= _('All passwords are encrypted prior to storage and are available to only those with the secret link. Once expired, encrypted passwords are unequivocally deleted from the database.') %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class='row'> | ||
<div class='col'> | ||
<p class='my-3'> | ||
<button class="form-control btn btn-primary" type="submit" data-form-target="pushit" data-disable-with="Pushing..."><%= _('Push It!') %></button> | ||
</p> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<%= render partial: 'shared/pw_generator_modal', cached: true %> | ||
|
||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class='text-center m-3'> | ||
<p class=""><strong><%= _('Please obtain and securely store this content in a secure manner, such as in a password manager.') %></strong></p> | ||
<% if Settings.pw.enable_blur %> | ||
<p class="text-muted"><%= _('Your password is blurred out. Click below to reveal it.') %></p> | ||
<% end %> | ||
<%= render partial: 'shared/copy_button', cached: true %> | ||
</div> | ||
|
||
<% if payload.chomp.match?(/\n/) || payload.length > 100 %> | ||
<div class='payload <%= blur_css_class %> notranslate px-5 border-top border-bottom border-5 w-100 bg-white d-flex justify-content-center' id='push_payload' translate='no' data-copy-target="payloadDiv"><pre class='text-break my-5'><%= payload %></pre></div> | ||
<% else %> | ||
<div class='payload <%= blur_css_class %> notranslate px-5 border-top border-bottom border-5 w-100 bg-white fs-2' id='push_payload' translate='no' data-copy-target="payloadDiv"><pre class='w-100 text-break text-wrap my-5 text-center'><%= payload %></pre></div> | ||
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class='text-center m-3'> | ||
<p class=""><strong><%= _('Please obtain and securely store this content in a secure manner, such as in a password manager.') %></strong></p> | ||
<%= qr_code(push.payload) %> | ||
<div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,8 @@ | |
File(s) | ||
<% elsif push.url? %> | ||
URL | ||
<% elsif push.qr? %> | ||
QR Code | ||
<% else %> | ||
Text | ||
<% end %> | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.