|
39 | 39 | <div class="field form-group mb-0">
|
40 | 40 | <label class="primary-checkpoint-container users-primary-checkpoint mb-0"><h6><%= t("users.sessions.remember_me") %></h6>
|
41 | 41 | <%= f.check_box :remember_me %>
|
42 |
| - <div class="primary-checkpoint m-0"></div> |
| 42 | + <div class="primary-checkpoint m-0" , id="remember_me"></div> |
43 | 43 | </label>
|
44 | 44 | </div>
|
45 | 45 | <% end -%>
|
|
69 | 69 | let emailInput = document.querySelector(".user-email-input");
|
70 | 70 | let passwordInput = document.querySelector(".users-password-input");
|
71 | 71 | let loginButton = document.querySelector(".users-login-primary-button");
|
| 72 | + let checkbox = document.getElementById("remember_me"); |
72 | 73 |
|
73 | 74 | toggledButton = () => {
|
| 75 | + |
74 | 76 | let emailInputValue = emailInput.value.trim();
|
75 | 77 | let passwordInputValue = passwordInput.value.trim();
|
76 | 78 |
|
77 |
| - if (emailInputValue !== "" && passwordInputValue !== "" ) { |
| 79 | + let isChecked = false; |
| 80 | + |
| 81 | + checkbox.addEventListener("click", () => { |
| 82 | + isChecked = !isChecked; |
| 83 | + |
| 84 | + if(emailInputValue !== "" && passwordInputValue !== "" && isChecked) |
78 | 85 | loginButton.disabled = false;
|
79 |
| - } |
| 86 | + else |
| 87 | + loginButton.disabled = true; |
| 88 | + }) |
80 | 89 | }
|
81 |
| - |
82 |
| - emailInput.addEventListener("input", toggledButton); |
83 |
| - passwordInput.addEventListener("input", toggledButton); |
| 90 | + emailInput.addEventListener("input", toggledButton); |
| 91 | + passwordInput.addEventListener("input", toggledButton); |
84 | 92 | });
|
85 | 93 | document.querySelector(".users-forgot-password-text").addEventListener('click', () => {
|
86 | 94 | localStorage.setItem('Email', querySelector(".user-email-input").val());
|
|
0 commit comments