diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index ce3e7242..0ca56ab2 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -1641,9 +1641,12 @@ def post_interested_user_edit(body): json={ "address_1": body['address_1'], "address_2": body['address_2'], + "address_3": body.get('address_3', None), + "phone": body['phone'], "city": body['city'], "state": body['state'], - "postal": body['postal'] + "postal": body['postal'], + "residential_address": body.get('residential_address', True) } ) if do_return: @@ -2080,12 +2083,14 @@ def post_submit_interest(body): "country": body['country'], "address_1": body['address_1'], "address_2": body['address_2'], + "address_3": body['address_3'], "city": body['city'], "state": body['state'], "postal": body['postal'], "confirm_consent": body['confirm_consent'], "over_18": body['over_18'], - "ip_address": ip_address + "ip_address": ip_address, + "residential_address": body['residential_address'] } ) @@ -2135,9 +2140,11 @@ def post_update_address(body): "email": body['email'], "address_1": body['address_1'], "address_2": body['address_2'], + "address_3": body['address_3'], "city": body['city'], "state": body['state'], - "postal": body['postal'] + "postal": body['postal'], + "residential_address": body['residential_address'] } ) diff --git a/microsetta_interface/static/js/spain_states.js b/microsetta_interface/static/js/spain_states.js new file mode 100644 index 00000000..ec151b74 --- /dev/null +++ b/microsetta_interface/static/js/spain_states.js @@ -0,0 +1,21 @@ +SPAIN_STATES = [ + ["AN", "Andalucia"], + ["AN", "Aragon"], + ["AST", "Asturias"], + ["IB", "Baleares"], + ["CE", "Ceuta"], + ["IC", "Canarias"], + ["C", "Cantabria"], + ["CM", "Castilla-La Mancha"], + ["CL", "Castilla y Leon"], + ["CAT", "Cataluna"], + ["VC", "Comunidad Valenciana"], + ["EXT", "Extremadura"], + ["G", "Galicia"], + ["LR", "La Rioja"], + ["M", "Madrid"], + ["ML", "Melilla"], + ["MU", "Murcia"], + ["NA", "Navarra"], + ["PA", "Pais Vasco"] +] diff --git a/microsetta_interface/static/vendor/jquery-validation/additional-methods.min.js b/microsetta_interface/static/vendor/jquery-validation/additional-methods.min.js new file mode 100644 index 00000000..8263fe38 --- /dev/null +++ b/microsetta_interface/static/vendor/jquery-validation/additional-methods.min.js @@ -0,0 +1,3 @@ +/*! jQuery Validation Plugin - v1.16.0 - 12/2/2016 + * http://jqueryvalidation.org/ +* Copyright (c) 2016 Jörn Zaefferer; Licensed MIT */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(e,f,a){var c=b(e),d=/\b\w+\b/g;return this.optional(f)||c.match(d).length>=a[0]&&c.match(d).length<=a[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(h,b,e){var c,f,d="string"==typeof e?e.replace(/\s/g,""):"image/*",g=this.optional(b);if(g)return g;if("file"===a(b).attr("type")&&(d=d.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),b.files&&b.files.length)){for(f=new RegExp(".?("+d+")$","i"),c=0;c9?"0":b,f="JABCDEFGHI".substr(b,1).toString(),g.match(/[ABEH]/)?e===b:g.match(/[KPQS]/)?e===f:e===b||e===f},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(11!==(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;var e,f,d,b,c=0;if(e=parseInt(a.substring(9,10),10),f=parseInt(a.substring(10,11),10),d=function(b,c){var a=10*b%11;return 10!==a&&11!==a||(a=0),a===c},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(b=1;b<=9;b++)c+=parseInt(a.substring(b-1,b),10)*(11-b);if(d(c,e)){for(c=0,b=1;b<=10;b++)c+=parseInt(a.substring(b-1,b),10)*(12-b);return d(c,f)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,f){if(this.optional(f))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var b,e=0,c=0,d=!1;if((a=a.replace(/\D/g,"")).length<13||a.length>19)return!1;for(b=a.length-1;b>=0;b--)c=parseInt(a.charAt(b),10),d&&(c*=2)>9&&(c-=9),e+=c,d=!d;return e%10==0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,d,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var b=0;return c.mastercard&&(b|=1),c.visa&&(b|=2),c.amex&&(b|=4),c.dinersclub&&(b|=8),c.enroute&&(b|=16),c.discover&&(b|=32),c.jcb&&(b|=64),c.unknown&&(b|=128),c.all&&(b=255),1&b&&/^(5[12345])/.test(a)?16===a.length:2&b&&/^(4)/.test(a)?16===a.length:4&b&&/^(3[47])/.test(a)?15===a.length:8&b&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&b&&/^(2(014|149))/.test(a)?15===a.length:32&b&&/^(6011)/.test(a)?16===a.length:64&b&&/^(3)/.test(a)?16===a.length:64&b&&/^(2131|1800)/.test(a)?15===a.length:!!(128&b)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(e,f,b){var c,d="string"==typeof b,a=d?b:b[0],g=!!d||b[1];return a=a.replace(/,/g,""),c="^["+(a=g?a+"]":a+"]?")+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",c=new RegExp(c),this.optional(f)||c.test(e)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(g,h){var b,c,d,e,a,f=!1;return/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(g)?(c=parseInt((b=g.split("/"))[0],10),d=parseInt(b[1],10),e=parseInt(b[2],10),a=new Date(Date.UTC(e,d-1,c,12,0,0,0)),f=a.getUTCFullYear()===e&&a.getUTCMonth()===d-1&&a.getUTCDate()===c):f=!1,this.optional(h)||f},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(b,c,a){return a="string"==typeof a?a.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(c)||b.match(new RegExp("\\.("+a+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(j,k){if(this.optional(k))return!0;var m,d,g,h,b,c,a=j.replace(/ /g,"").toUpperCase(),e="",i=!0,f="",l=5;if(a.length9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("nieES",function(a){"use strict";var b,c=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),d=a.substr(a.length-1).toUpperCase();return!((a=a.toString().toUpperCase()).length>10||a.length<9||!c.test(a))&&(b=9===(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2")).length?a.substr(0,8):a.substr(0,9),"TRWAGMYFPDXBNJZSQVHLCKET".charAt(parseInt(b,10)%23)===d)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a){return!!(a=a.toUpperCase()).match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&"@"===a[8])},"Please specify a valid NIF number."),a.validator.addMethod("notEqualTo",function(c,b,d){return this.optional(b)||!a.validator.methods.equalTo.call(this,c,b,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(b,c,a){return!!this.optional(c)||("string"==typeof a&&(a=new RegExp("^(?:"+a+")$")),a.test(b))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneSPAIN",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>=9&&a.match(/^(\+?34-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{3}$/)},"Please specify a valid phone number"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP v\xe1lido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(h,d,e){var b=a(e[1],d.form),c=b.eq(0),f=c.data("valid_req_grp")?c.data("valid_req_grp"):a.extend({},this),g=b.filter(function(){return f.elementValue(this)}).length>=e[0];return c.data("valid_req_grp",f),a(d).data("being_validated")||(b.data("being_validated",!0),b.each(function(){f.element(this)}),b.data("being_validated",!1)),g},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(i,d,e){var b=a(e[1],d.form),c=b.eq(0),g=c.data("valid_skip")?c.data("valid_skip"):a.extend({},this),f=b.filter(function(){return g.elementValue(this)}).length,h=0===f||f>=e[0];return c.data("valid_skip",g),a(d).data("being_validated")||(b.data("being_validated",!0),b.each(function(){g.element(this)}),b.data("being_validated",!1)),h},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(f,g,a){var b,c=void 0===a,h=!c&& void 0!==a.caseSensitive&&a.caseSensitive,d=!c&& void 0!==a.includeTerritories&&a.includeTerritories,e=!c&& void 0!==a.includeMilitary&&a.includeMilitary;return b=d||e?d&&e?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":d?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",b=h?new RegExp(b):new RegExp(b,"i"),this.optional(g)||b.test(f)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,d,c){return a(b).text().length>=c},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(h){if(17!==h.length)return!1;var b,c,a,e,f,d,g=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],j=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],k=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],i=0;for(b=0;b<17;b++){if(e=k[b],a=h.slice(b,b+1),8===b&&(d=a),isNaN(a)){for(c=0;c + + + + + + +{% endblock %} + {% block content %} -
- - - {% if updated is true %} - - - - {% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Interested User Successfully Updated

{{ _('Edit Interested User') }}
{{ _('CAUTION: Edits made will NOT go through address verification - proceed carefully') }}
{{ interested_user.first_name |e}}
{{ interested_user.last_name |e}}
{{ interested_user.email |e}}
{{ interested_user.phone |e}}
{{ interested_user.country |e}}
-
+
+ + + {% if updated is true %} + + + + {% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% if interested_user.address_3 %} + + + + + {% endif %} + + + + + + + + + + + + + + + {% if interested_user.residential_address %} + + + + + {% endif %} + + + + + + + + + + + +
Interested User Successfully Updated

{{ _('Edit Interested User') }}
{{ _('CAUTION: Edits made will NOT go through address verification - proceed carefully') }}
{{ interested_user.first_name |e}}
{{ interested_user.last_name |e}}
{{ interested_user.email |e}}
+ +
{{ interested_user.country |e}}
+
{% endblock %} diff --git a/microsetta_interface/templates/submit_interest.jinja2 b/microsetta_interface/templates/submit_interest.jinja2 index 3cb1fcfa..05884466 100644 --- a/microsetta_interface/templates/submit_interest.jinja2 +++ b/microsetta_interface/templates/submit_interest.jinja2 @@ -9,8 +9,9 @@ + - +