|
108 | 108 | background-image: -ms-linear-gradient(#00395E,#005891);
|
109 | 109 | background-image: linear-gradient(#00395E,#005891);
|
110 | 110 | }
|
111 |
| - |
| 111 | + |
| 112 | + button:disabled, |
| 113 | + button[disabled] { |
| 114 | + opacity: 0.5; |
| 115 | + } |
| 116 | + |
112 | 117 | input {
|
113 | 118 | color: black;
|
114 | 119 | cursor: auto;
|
|
126 | 131 | word-spacing: 0px;
|
127 | 132 | }
|
128 | 133 |
|
| 134 | + #password_match_info { |
| 135 | + margin-top: 0px; |
| 136 | + font-size: 13px; |
| 137 | + color: red; |
| 138 | + } |
| 139 | + |
129 | 140 | </style>
|
130 | 141 | </head>
|
131 | 142 | <body>
|
|
134 | 145 | <div class='error' id='error'></div>
|
135 | 146 | <form id='form' action='#' method='POST'>
|
136 | 147 | <label>New Password for <span id='username_label'></span></label>
|
137 |
| - <input name="new_password" type="password" /> |
| 148 | + |
| 149 | + <span>New Password</span> |
| 150 | + <input name="new_password" type="password" id="password"/> <br> |
| 151 | + |
| 152 | + <span>Confirm New Password</span> |
| 153 | + <input name="confirm_new_password" type="password" id="password_confirm"/> |
| 154 | + <span id="password_match_info"></span> |
| 155 | + |
138 | 156 | <input name='utf-8' type='hidden' value='✓' />
|
139 | 157 | <input name="username" id="username" type="hidden" />
|
140 | 158 | <input name="token" id="token" type="hidden" />
|
141 |
| - <button>Change Password</button> |
| 159 | + |
| 160 | + |
| 161 | + <button id="change_password">Change Password</button> |
142 | 162 | </form>
|
143 | 163 |
|
144 | 164 | <script language='javascript' type='text/javascript'>
|
|
162 | 182 | document.getElementById('form').setAttribute('action', base + '/apps/' + id + '/request_password_reset');
|
163 | 183 | document.getElementById('username').value = urlParams['username'];
|
164 | 184 | document.getElementById('username_label').appendChild(document.createTextNode(urlParams['username']));
|
| 185 | + document.getElementById("password").oninput = validatePassword; |
| 186 | + document.getElementById("password_confirm").oninput = validatePassword; |
| 187 | + document.getElementById("change_password").disabled = true; |
165 | 188 |
|
166 | 189 | document.getElementById('token').value = urlParams['token'];
|
167 | 190 | if (urlParams['error']) {
|
|
170 | 193 | if (urlParams['app']) {
|
171 | 194 | document.getElementById('app').appendChild(document.createTextNode(' for ' + urlParams['app']));
|
172 | 195 | }
|
| 196 | + |
| 197 | + function validatePassword() { |
| 198 | + var pass2 = document.getElementById("password").value; |
| 199 | + var pass1 = document.getElementById("password_confirm").value; |
| 200 | + if(pass1 !== pass2) { |
| 201 | + if(document.getElementById("password_confirm").value) { |
| 202 | + document.getElementById("change_password").disabled = true; |
| 203 | + document.getElementById("password_match_info").innerHTML = "Must match the previous entry"; |
| 204 | + } |
| 205 | + } else { |
| 206 | + document.getElementById("change_password").disabled = false; |
| 207 | + document.getElementById("password_match_info").innerHTML = ""; |
| 208 | + } |
| 209 | + //empty string means no validation error |
| 210 | + } |
| 211 | + |
173 | 212 | }
|
174 | 213 | //-->
|
175 | 214 | </script>
|
|
0 commit comments