Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Commit

Permalink
Add ShowPassword package. (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Martin authored Feb 11, 2018
1 parent a8d7d9d commit d4204d4
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//= require react
//= require react_ujs
//= require components
//= require show_password/show_password
//= require_tree .

var update = React.addons.update
Expand Down
4 changes: 3 additions & 1 deletion app/assets/javascripts/password.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$(document).on('turbolinks:load', function() {
if ($('body').hasClass('users-new') || $('body').hasClass('passwords-edit')) {
$('#registration_password, #reset_password').focus(function(e) {
ShowPassword.initialize()

$('#registration_password, #reset_password').on("focus", function(e) {
$('.passwordRules').removeClass('hidden')
})

Expand Down
6 changes: 5 additions & 1 deletion app/assets/javascripts/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ function setGoogleButtonText() {
}

$(document).on('turbolinks:load', function() {
setTimeout(setGoogleButtonText, 100)
if ($("body").hasClass('sessions-new')) {
ShowPassword.initialize()

setTimeout(setGoogleButtonText, 100)
}
})
4 changes: 3 additions & 1 deletion app/views/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

<div class="inputGroup">
<%= label_tag :password %>
<%= password_field_tag :password %>
<div id="showHidePassword">
<%= password_field_tag :password %>
</div>
</div>

<div class="inputGroup flexRow flexAlignCenter">
Expand Down
4 changes: 3 additions & 1 deletion app/views/users/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
<li>Doesn't match your email <span class="xMark"></span></li>
</ol>
</div>
<%= f.password_field :password, data: { rules: "checkLength,checkTop100,ensureDoesntMatchEmail" } %>
<div id="showHidePassword">
<%= f.password_field :password, data: { rules: "checkLength,checkTop100,ensureDoesntMatchEmail" } %>
</div>
</div>

<div class="inputGroup flexRow flexAlignCenter">
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Rails.application.config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")

# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
Rails.application.config.assets.paths << Rails.root.join("node_modules")

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Expand Down
14 changes: 14 additions & 0 deletions node_modules/.yarn-integrity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
21 changes: 21 additions & 0 deletions node_modules/show_password/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions node_modules/show_password/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions node_modules/show_password/readme.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions node_modules/show_password/show_password.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"show_password": "^0.0.3"
}
}
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


show_password@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/show_password/-/show_password-0.0.3.tgz#8e2112cd03671f15fef5029bf0eb4baf9565756b"

0 comments on commit d4204d4

Please sign in to comment.