Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 1b74d9e

Browse files
committed
Sanitized messages & fixed issue #69
- Added sanitize to the demo page - Fixed issue #69, display proper error message when user type invalid chars on an input[number]
1 parent 2d9ba48 commit 1b74d9e

29 files changed

+566
-181
lines changed

app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var myApp = angular.module('myApp', ['ngRoute', 'ghiscoding.validation', 'pascalprecht.translate']);
3+
var myApp = angular.module('myApp', ['ngRoute', 'ngSanitize', 'ghiscoding.validation', 'pascalprecht.translate']);
44

55
myApp.config(['$compileProvider', '$locationProvider', '$routeProvider', function ($compileProvider, $locationProvider, $routeProvider) {
66
$compileProvider.debugInfoEnabled(false);
@@ -19,6 +19,7 @@ myApp.config(['$compileProvider', '$locationProvider', '$routeProvider', functio
1919

2020
// load English ('en') table on startup
2121
$translateProvider.preferredLanguage('en');
22+
$translateProvider.useSanitizeValueStrategy('escapeParameters');
2223
}]);
2324

2425
// -- Main page Controller

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-validation-ghiscoding",
3-
"version": "1.4.9",
3+
"version": "1.4.10",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": [

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Angular-Validation change logs
22

3+
1.4.10 (2015-10-12) Sanitized error messages. Fixed issue #69 - Stop when invalid characters typed on input[number].
4+
1.4.9 (2015-10-05) Enhancement #57, #66, #67 - Added 3rd party addon validation (like ngTagsInput, Angular Multiselect, Dropdown multi-select, etc...)
35
1.4.8 (2015-09-12) Fixed issue #68 - Matching validation issue (password confirmation).
46
1.4.7 (2015-09-08) Fixed issue #65 - invalid return value on function String.format()
57
1.4.6 (2015-09-04) Accepted pull #64 - Update Spanish `es.json` translation file.

dist/angular-validation.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

full-tests/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ <h1>Angular-Validation Directive|Service (ghiscoding)</h1>
3535
<ng-view></ng-view>
3636

3737
<!-- external librairies CDN -->
38-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
39-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular-route.js"></script>
38+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
39+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.js"></script>
4040

4141
<!-- angular-translate -->
4242
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ <h1>Angular-Validation Directive|Service (ghiscoding)</h1>
4040
<ng-view></ng-view>
4141

4242
<!-- external librairies CDN -->
43-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
44-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular-route.js"></script>
43+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
44+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.js"></script>
45+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-sanitize.js"></script>
4546

4647
<!-- angular-translate -->
4748
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->

locales/validation/en.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"INVALID_FLOAT_SIGNED": "May only contain a positive or negative float value (integer excluded). ",
4040
"INVALID_IBAN": "Must be a valid IBAN. ",
4141
"INVALID_IN_LIST": "Must be a choice inside this list: ({0}). ",
42-
"INVALID_INPUT_DIFFERENT": "Field must be different from specified field \"{1}\". ",
43-
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \"{1}\". ",
42+
"INVALID_INPUT_DIFFERENT": "Field must be different from specified field [{1}]. ",
43+
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field [{1}]. ",
4444
"INVALID_INTEGER": "Must be a positive integer. ",
4545
"INVALID_INTEGER_SIGNED": "Must be a positive or negative integer. ",
4646
"INVALID_IPV4": "Must be a valid IP (IPV4). ",
4747
"INVALID_IPV6": "Must be a valid IP (IPV6). ",
4848
"INVALID_IPV6_HEX": "Must be a valid IP (IPV6 Hex). ",
49-
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type \"number\". ",
49+
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type 'number'. ",
5050
"INVALID_MAX_CHAR": "May not be greater than {0} characters. ",
5151
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than {0}. ",
5252
"INVALID_MIN_CHAR": "Must be at least {0} characters. ",
@@ -55,7 +55,7 @@
5555
"INVALID_NUMERIC": "Must be a positive number. ",
5656
"INVALID_NUMERIC_SIGNED": "Must be a positive or negative number. ",
5757
"INVALID_PATTERN": "Must be following this format: {0}. ",
58-
"INVALID_PATTERN_DATA": "Must be following this format \"{{data}}\". ",
58+
"INVALID_PATTERN_DATA": "Must be following this format {{data}}. ",
5959
"INVALID_REQUIRED": "Field is required. ",
6060
"INVALID_URL": "Must be a valid URL. ",
6161
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",
@@ -65,8 +65,8 @@
6565
"ERRORS": "Errors",
6666
"CHANGE_LANGUAGE": "Change language",
6767
"FORM_PREVALIDATED": "Form is pre-validated",
68-
"INPUT1": "Remote validation - Type \"abc\" for a valid answer ",
69-
"INPUT2": "Number positive or negative -- input type=\"number\" -- Error on non-numeric characters ",
68+
"INPUT1": "Remote validation - Type 'abc' for a valid answer ",
69+
"INPUT2": "Number positive or negative -- input type='number' -- Error on non-numeric characters ",
7070
"INPUT3": "Floating number range (integer excluded) -- between_num:x,y OR min_num:x|max_num:y ",
7171
"INPUT4": "Multiple Validations + Custom Regex of Date Code (YYWW)",
7272
"INPUT5": "Email",
@@ -77,7 +77,7 @@
7777
"INPUT10": "Date ISO (yyyy-mm-dd)",
7878
"INPUT11": "Date US LONG (mm/dd/yyyy)",
7979
"INPUT12": "Time (hh:mm OR hh:mm:ss) -- NOT Required",
80-
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=\" \"",
80+
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=' '",
8181
"INPUT14": "Alphanumeric + Required -- NG-DISABLED",
8282
"INPUT15": "Password",
8383
"INPUT16": "Password Confirmation",

locales/validation/es.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"INVALID_FLOAT_SIGNED": "Debe contener un número decimal positivo ó negativo (Los números enteros no son válidos). ",
4040
"INVALID_IBAN": "Debe contener un IBAN válido. ",
4141
"INVALID_IN_LIST": "Debe ser una opción dentro de esta lista: ({0}). ",
42-
"INVALID_INPUT_DIFFERENT": "El campo debe ser diferente del campo \"{1}\" especificado. ",
43-
"INVALID_INPUT_MATCH": "El campo de confirmación no coincide con el texto especificado en \"{1}\". ",
42+
"INVALID_INPUT_DIFFERENT": "El campo debe ser diferente del campo [{1}] especificado. ",
43+
"INVALID_INPUT_MATCH": "El campo de confirmación no coincide con el texto especificado en [{1}]. ",
4444
"INVALID_INTEGER": "Debe contener un número entero positivo. ",
4545
"INVALID_INTEGER_SIGNED": "Debe contener un número entero positivo ó negativo. ",
4646
"INVALID_IPV4": "Debe contener una dirección IP válida (IPV4). ",
4747
"INVALID_IPV6": "Debe contener una dirección IP válida (IPV6). ",
4848
"INVALID_IPV6_HEX": "Debe contener una dirección IP válida (IPV6 Hex). ",
49-
"INVALID_KEY_CHAR": "Entrada de teclado no válida en un campo de tipo \"number\". ",
49+
"INVALID_KEY_CHAR": "Entrada de teclado no válida en un campo de tipo 'number'. ",
5050
"INVALID_MAX_CHAR": "No puede contener más de {0} caracteres. ",
5151
"INVALID_MAX_NUM": "Debe contener un valor númerico igual o menor que {0}. ",
5252
"INVALID_MIN_CHAR": "Debe contener al menos {0} caracteres. ",
@@ -55,6 +55,7 @@
5555
"INVALID_NUMERIC": "Debe contener un valor númerico positivo. ",
5656
"INVALID_NUMERIC_SIGNED": "Debe contener un valor númerico positivo ó negativo. ",
5757
"INVALID_PATTERN": "Debe contener un texto con el formato: {0}. ",
58+
"INVALID_PATTERN_DATA": "Debe contener un texto con el formato {{data}}. ",
5859
"INVALID_REQUIRED": "Campo requerido. ",
5960
"INVALID_URL": "Debe contener una dirección URL válida. ",
6061
"INVALID_TIME": "Debe contener un formato de tiempo válido (hh:mm) ó (hh:mm:ss). ",
@@ -64,8 +65,8 @@
6465
"ERRORS": "Errores",
6566
"CHANGE_LANGUAGE": "Cambiar idioma",
6667
"FORM_PREVALIDATED": "El formulario es pre-validado",
67-
"INPUT1": "Validación Remota - Escriba \"abc\" para una respuesta válida ",
68-
"INPUT2": "Número positivo o negativo -- input type=\"number\" -- Error o caracteres no númericos ",
68+
"INPUT1": "Validación Remota - Escriba 'abc' para una respuesta válida ",
69+
"INPUT2": "Número positivo o negativo -- input type='number' -- Error o caracteres no númericos ",
6970
"INPUT3": "Rango decimal (Los números enteros no son válidos) -- between_num:x,y ó min_num:x|max_num:y ",
7071
"INPUT4": "Multiples validaciones + Código de fecha personalizado (YYWW)",
7172
"INPUT5": "Email",
@@ -76,7 +77,7 @@
7677
"INPUT10": "Fecha formato ISO (yyyy-mm-dd)",
7778
"INPUT11": "Fecha formato US largo (mm/dd/yyyy)",
7879
"INPUT12": "Tiempo (hh:mm ó hh:mm:ss) -- No Requerido",
79-
"INPUT13": "AlphaDashSpaces + Requerido + Mínimo(5) Caracteres -- Deben ser: validation-error-to=\" \"",
80+
"INPUT13": "AlphaDashSpaces + Requerido + Mínimo(5) Caracteres -- Deben ser: validation-error-to=' '",
8081
"INPUT14": "Alfanúmerico + Requerido -- NG-DISABLED",
8182
"INPUT15": "Contraseña",
8283
"INPUT16": "Confirmación de Contraseña",

locales/validation/fr.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"INVALID_FLOAT_SIGNED": "Doit être obligatoirement un nombre flottant positif ou négatif (nombre entier exclu). ",
4040
"INVALID_IBAN": "Doit être un IBAN valide. ",
4141
"INVALID_IN_LIST": "Doit être un choix dans cette liste: ({0}). ",
42-
"INVALID_INPUT_DIFFERENT": "Le champ doit être différente du champ spécifié \"{1}\". ",
43-
"INVALID_INPUT_MATCH": "Le champ de confirmation ne correspond pas au champs spécifié \"{1}\". ",
42+
"INVALID_INPUT_DIFFERENT": "Le champ doit être différente du champ spécifié [{1}]. ",
43+
"INVALID_INPUT_MATCH": "Le champ de confirmation ne correspond pas au champs spécifié [{1}]. ",
4444
"INVALID_INTEGER": "Doit être un nombre entier positif. ",
4545
"INVALID_INTEGER_SIGNED": "Doit être un nombre entier positif ou négatif. ",
4646
"INVALID_IPV4": "Doit être un IP valide (IPV4). ",
4747
"INVALID_IPV6": "Doit être un IP valide (IPV6). ",
4848
"INVALID_IPV6_HEX": "Doit être un IP valide (IPV6 Hex). ",
49-
"INVALID_KEY_CHAR": "Entrée clavier invalide sur un champs de type \"nombre\". ",
49+
"INVALID_KEY_CHAR": "Entrée clavier invalide sur un champs de type 'nombre'. ",
5050
"INVALID_MAX_CHAR": "Doit être plus petit que {0} caractères. ",
5151
"INVALID_MAX_NUM": "Doit être une valeur numérique, égale ou inférieure à {0}. ",
5252
"INVALID_MIN_CHAR": "Doit avoir au moins {0} caractères. ",
@@ -55,7 +55,7 @@
5555
"INVALID_NUMERIC": "Doit être un nombre positif. ",
5656
"INVALID_NUMERIC_SIGNED": "Doit être un nombre positif ou négatif. ",
5757
"INVALID_PATTERN": "Doit suivre le format: {0}. ",
58-
"INVALID_PATTERN_DATA": "Doit suivre le format \"{{data}}\". ",
58+
"INVALID_PATTERN_DATA": "Doit suivre le format {{data}}. ",
5959
"INVALID_REQUIRED": "Le champ est requis. ",
6060
"INVALID_URL": "Doit être un URL valide. ",
6161
"INVALID_TIME": "Doit être un format de temps valide (hh:mm) OU (hh:mm:ss). ",
@@ -65,8 +65,8 @@
6565
"ERRORS": "Erreurs",
6666
"CHANGE_LANGUAGE": "Changer de langue",
6767
"FORM_PREVALIDATED": "Formulaire est pré-validé",
68-
"INPUT1": "Validation à Distance - Taper \"abc\" pour une réponse valide ",
69-
"INPUT2": "Nombre positif ou négatif -- input type=\"number\" -- Erreur sur caractères non-numérique",
68+
"INPUT1": "Validation à Distance - Taper 'abc' pour une réponse valide ",
69+
"INPUT2": "Nombre positif ou négatif -- input type='number' -- Erreur sur caractères non-numérique",
7070
"INPUT3": "Intervalle de Nombre Flottant (entier exclu) -- between_num:x,y OU min_num:x|max_num:y",
7171
"INPUT4": "Multiple Validations + Regex Personnalisé d'un Code Date (AASS)",
7272
"INPUT5": "Courriel",
@@ -77,7 +77,7 @@
7777
"INPUT10": "Date ISO (aaaa-mm-jj)",
7878
"INPUT11": "Date US LONG (mm/jj/aaaa)",
7979
"INPUT12": "Time (hh:mm OU hh:mm:ss) -- NON Requis",
80-
"INPUT13": "AlphaDashSpaces + Requis + Minimum(5) Caractères -- DOIT UTILISER: validation-error-to=\" \"",
80+
"INPUT13": "AlphaDashSpaces + Requis + Minimum(5) Caractères -- DOIT UTILISER: validation-error-to=' '",
8181
"INPUT14": "Alphanumérique + Requis -- NG-DISABLED",
8282
"INPUT15": "Mot de Passe",
8383
"INPUT16": "Mot de Passe (Confirmation)",

locales/validation/no.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"INVALID_FLOAT_SIGNED": "Kan bare inneholde en positiv eller negativ flyttalsverdi (heltall ekskludert). ",
4040
"INVALID_IBAN": "Må være en gyldig IBAN. ",
4141
"INVALID_IN_LIST": "Må være et valg inne i denne listen: ({0}). ",
42-
"INVALID_INPUT_DIFFERENT": "Feltet skal være forskjellig fra den angitte felt \"{1}\". ",
43-
"INVALID_INPUT_MATCH": "Bekreftelsesfeltet er ikke likt spesifisert felt \"{1}\". ",
42+
"INVALID_INPUT_DIFFERENT": "Feltet skal være forskjellig fra den angitte felt [{1}]. ",
43+
"INVALID_INPUT_MATCH": "Bekreftelsesfeltet er ikke likt spesifisert felt [{1}]. ",
4444
"INVALID_INTEGER": "Må være et positivt heltall. ",
4545
"INVALID_INTEGER_SIGNED": "Må være et positivt eller negativt heltall. ",
4646
"INVALID_IPV4": "Må være en gyldig IP-adresse (IPV4). ",
4747
"INVALID_IPV6": "Må være en gyldig IP-adresse (IPV6). ",
4848
"INVALID_IPV6_HEX": "Må være en gyldig IP-adresse (IPV6 Hex). ",
49-
"INVALID_KEY_CHAR": "Ugyldig tastaturoppføring på felt av type \"number\". ",
49+
"INVALID_KEY_CHAR": "Ugyldig tastaturoppføring på felt av type 'number'. ",
5050
"INVALID_MAX_CHAR": "Kan ikke være større enn {0} characters. ",
5151
"INVALID_MAX_NUM": "Må være en numerisk verdi, lik, eller mindre enn {0}. ",
5252
"INVALID_MIN_CHAR": "Må være minst {0} tegn. ",
@@ -55,7 +55,7 @@
5555
"INVALID_NUMERIC": "Må være et positivt tall. ",
5656
"INVALID_NUMERIC_SIGNED": "Må være et positivt eller negativt tall. ",
5757
"INVALID_PATTERN": "Må være på følgende format: {0}. ",
58-
"INVALID_PATTERN_DATA": "Må være på følgende format \"{{data}}\". ",
58+
"INVALID_PATTERN_DATA": "Må være på følgende format {{data}}. ",
5959
"INVALID_REQUIRED": "Feltet er påkrevd. ",
6060
"INVALID_URL": "Må være en gyldig URL. ",
6161
"INVALID_TIME": "Må være et gyldig tidsformat (tt:mm) OR (tt:mm:ss). ",
@@ -65,8 +65,8 @@
6565
"ERRORS": "Feil",
6666
"CHANGE_LANGUAGE": "Endre språk.",
6767
"FORM_PREVALIDATED": "Form er pre-godkjent",
68-
"INPUT1": "Ekstern Validering - Type \"abc\" for et gyldig svar ",
69-
"INPUT2": "Positivt eller negativt nummer -- input type=\"number\" -- Feil på ikke-numeriske tegn ",
68+
"INPUT1": "Ekstern Validering - Type 'abc' for et gyldig svar ",
69+
"INPUT2": "Positivt eller negativt nummer -- input type='number' -- Feil på ikke-numeriske tegn ",
7070
"INPUT3": "Flyttalssutvalg (heltall ekskludert) -- between_num:x,y eller min_num:x|max_num:y ",
7171
"INPUT4": "Multiple Valideringer + Tilpasset Regex av dato kode (YYWW)",
7272
"INPUT5": "Epost",
@@ -77,7 +77,7 @@
7777
"INPUT10": "ISO dato (yyyy-mm-dd)",
7878
"INPUT11": "US LONG dato (mm/dd/yyyy)",
7979
"INPUT12": "Tid (hh:mm eller hh:mm:ss) -- IKKE Påkrevd",
80-
"INPUT13": "AlphaDashSpaces + Påkrevd + Minimum(5) Tegn -- MÅ BRUKE: validation-error-to=\" \"",
80+
"INPUT13": "AlphaDashSpaces + Påkrevd + Minimum(5) Tegn -- MÅ BRUKE: validation-error-to=' '",
8181
"INPUT14": "Alfanumerisk + Påkrevd -- NG-DISABLED",
8282
"INPUT15": "Passord",
8383
"INPUT16": "Passord bekreftelse",

0 commit comments

Comments
 (0)