~unifield-team/unifield-web/trunk

« back to all changes in this revision

Viewing changes to openobject/widgets/templates/form.mako

  • Committer: jf
  • Date: 2016-08-23 11:54:24 UTC
  • mfrom: (4794.6.5 web-us-1519)
  • Revision ID: jfb@tempo-consulting.fr-20160823115424-oiz4dm2jxia4b09h
US-1519 [IMP] Prevent browser to save password

lp:~jfb-tempo-consulting/unifield-web/us-1519

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
        % endfor
33
33
        <tr>
34
34
            <td>&nbsp;</td>
35
 
            <td align="right" style="padding: 0px 5px 5px 0px;"><button type="submit" class="static_boxes">${submit_text}</button></td>
 
35
            <td align="right" style="padding: 0px 5px 5px 0px;">
 
36
            % if not replace_password_fields:
 
37
                <button type="submit" class="static_boxes">${submit_text}</button>
 
38
            % else:
 
39
                <script type="text/javascript">
 
40
                function replace_pass_submit() {
 
41
                    var this_form = false;
 
42
                    % for src_field, target_field in replace_password_fields.iteritems():
 
43
                        if (!this_form) {
 
44
                            this_form = $("#${target_field}").attr('form');
 
45
                            var result = true;
 
46
                            if (this_form.onsubmit) {
 
47
                                result = this_form.onsubmit.call(this_form);
 
48
                            }
 
49
                            if (!result) {
 
50
                                return false;
 
51
                            }
 
52
                        }
 
53
                        var ${src_field}_val = $("#${src_field}").val()
 
54
                        var fake_${src_field} = jQuery('<input type="text"/>');
 
55
                        fake_${src_field}.addClass($("#${src_field}").attr('class'));
 
56
                        fake_${src_field}.val(Array(${src_field}_val.length+1).join('\u2022'));
 
57
                        $("#${target_field}").val(${src_field}_val);
 
58
                        $("#${src_field}").val(false);
 
59
                        $("#${src_field}").replaceWith(fake_${src_field});
 
60
                    % endfor
 
61
                    this_form.submit();
 
62
                }
 
63
                </script>
 
64
                <button type="button" class="static_boxes" onclick="replace_pass_submit()">${submit_text}</button>
 
65
            % endif
 
66
            </td>
36
67
        </tr>
37
68
    </table>
38
69
</form>