refactor: Remove inline javascript code from reset_confirm.html.

This commit removes inline javascript code present in reset_confirm.html
and moves it to signup.js. The reset_confirm.html page is rendered when
the user visits "/accounts/password/reset" confirmation page. An empty
div element is added in reset_confirm.html with unique data-page-id
attribute to make it more easy to find in which page we are, while
working with the javascript code.
This commit is contained in:
Abhinav Singh
2019-03-09 21:37:38 +05:30
committed by Tim Abbott
parent 17d9c24094
commit 4b8f6b55be
2 changed files with 9 additions and 3 deletions

View File

@@ -73,6 +73,12 @@ $(function () {
$("#timezone").val(moment.tz.guess());
}
// Code in this block will be executed when the user visits
// /accounts/password/reset i.e. reset.html is rendered.
if ($("[data-page-id='reset-password-confirm']").length > 0) {
common.autofocus('#id_new_password1');
}
// Code in this block will be executed when the user visits
// /accounts/password/reset i.e. reset.html is rendered.
if ($("[data-page-id='reset-password']").length > 0) {

View File

@@ -6,6 +6,9 @@
{% block portico_content %}
<!-- The following empty tag has unique data-page-id so that this
page can be easily identified in it's respective JavaScript file -->
<div data-page-id="reset-password-confirm"></div>
<div class="password-container flex full-page new-style">
<!-- wrapper for flex content -->
@@ -65,9 +68,6 @@
</div>
</form>
<script>
common.autofocus('#id_new_password1');
</script>
{% else %}
<p>{{ _('Sorry, the link you provided is invalid or has already been used.') }}</p>
{% endif %}