[IMP] auth_signup: Disable 'Sign Up' button to prevent user from continuous clicking

This commit is contained in:
Sanjay Jamod
2017-09-26 11:02:26 +02:00
committed by Yannick Tivisse
parent 25a0b0f4db
commit 67d1173bf3
4 changed files with 26 additions and 1 deletions
+1
View File
@@ -20,6 +20,7 @@ Allow users to sign up and reset their password
'views/res_config_settings_views.xml',
'views/res_users_views.xml',
'views/auth_signup_login_templates.xml',
'views/auth_signup_assets.xml',
],
'bootstrap': True,
}
@@ -0,0 +1,16 @@
odoo.define('auth_signup.signup', function (require) {
'use strict';
var base = require('web_editor.base');
base.ready().then(function() {
// Disable 'Sign Up' button to prevent user form continuous clicking
if ($('.oe_signup_form').length > 0) {
$('.oe_signup_form').on('submit', function () {
$('.o_signup_btn').attr('disabled', 'disabled');
$('.o_signup_btn').prepend('<i class="fa fa-refresh fa-spin"/> ');
});
}
});
});
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_frontend" inherit_id="web.assets_frontend" name="Auth Assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/auth_signup/static/src/js/signup.js"></script>
</xpath>
</template>
</odoo>
@@ -50,7 +50,7 @@
<input type="hidden" name="token" t-att-value="token"/>
<div class="clearfix oe_login_buttons">
<a t-attf-href="/web/login?{{ keep_query() }}" class="btn btn-link pull-right">Already have an account?</a>
<button type="submit" class="btn btn-primary pull-left">Sign up</button>
<button type="submit" class="btn btn-primary pull-left o_signup_btn"> Sign up</button>
</div>
</form>