From: Jakob Kramer Date: Sat, 24 Mar 2012 16:36:12 +0000 (+0100) Subject: Fill username automatically in (Forget Password) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6c49799deb6bf776d3765febeb9d7959e27af43d;p=mediagoblin.git Fill username automatically in (Forget Password) Fill the username automatically in the "Forget Password" form if the user already entered his username on the login page --- diff --git a/mediagoblin/static/js/autofilledin_password.js b/mediagoblin/static/js/autofilledin_password.js new file mode 100644 index 00000000..9513c273 --- /dev/null +++ b/mediagoblin/static/js/autofilledin_password.js @@ -0,0 +1,27 @@ +/** + * GNU MediaGoblin -- federated, autonomous media hosting + * Copyright (C) 2012 MediaGoblin contributors. See AUTHORS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +$(document).ready(function(){ + $('#forgot_password').click(function(event){ + event.preventDefault(); + window.location.pathname = $(this).attr('href') + '?username=' + + $('#username').val(); + }); + + $('#username').val(window.location.search.match(/username=(.*)/)[1]); +}); diff --git a/mediagoblin/templates/mediagoblin/auth/forgot_password.html b/mediagoblin/templates/mediagoblin/auth/forgot_password.html index 672e9d9a..435b63e1 100644 --- a/mediagoblin/templates/mediagoblin/auth/forgot_password.html +++ b/mediagoblin/templates/mediagoblin/auth/forgot_password.html @@ -19,6 +19,11 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} +{% block mediagoblin_head %} + +{% endblock %} + {% block mediagoblin_content %}
diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html index 39f07d33..8161ea9d 100644 --- a/mediagoblin/templates/mediagoblin/auth/login.html +++ b/mediagoblin/templates/mediagoblin/auth/login.html @@ -19,6 +19,11 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} +{% block mediagoblin_head %} + +{% endblock %} + {% block mediagoblin_content %} @@ -38,7 +43,7 @@ {% endif %} {{ wtforms_util.render_divs(login_form) }}

- + {% trans %}Forgot your password?{% endtrans %}