@@ -2,8 +2,7 @@ var path = require('path'),
2
2
db = require ( '../models/webideModel' ) ,
3
3
scripts_helper = require ( '../helpers/scripts_helper' ) ,
4
4
config = require ( '../config/config' ) ,
5
- check = require ( 'validator' ) . check ,
6
- sanitize = require ( 'validator' ) . sanitize ;
5
+ sanitize = require ( 'validator' ) ;
7
6
8
7
// Instructional page that displays the setup steps
9
8
exports . setup = function ( req , res ) {
@@ -30,9 +29,9 @@ exports.submit_setup = function(req, res) {
30
29
}
31
30
32
31
try {
33
- name = sanitize ( req . body . name ) . trim ( ) ;
34
- email = sanitize ( req . body . email ) . trim ( ) ;
35
- check ( email ) . isEmail ( ) ;
32
+ name = sanitize . trim ( req . body . name ) ;
33
+ email = sanitize . trim ( req . body . email ) ;
34
+ sanitize . isEmail ( email ) ;
36
35
} catch ( e ) {
37
36
req . session . message = e . message ;
38
37
console . log ( e . message ) ;
@@ -71,10 +70,10 @@ exports.submit_config = function(req, res) {
71
70
req . session . message = undefined ;
72
71
73
72
try {
74
- hostname = sanitize ( req . body . hostname ) . trim ( ) ;
75
- wifi_ssid = sanitize ( req . body . wifi_ssid ) . trim ( ) ;
76
- wifi_password = sanitize ( req . body . wifi_password ) . trim ( ) ;
77
- port = sanitize ( req . body . port ) . trim ( ) ;
73
+ hostname = sanitize . trim ( req . body . hostname ) ;
74
+ wifi_ssid = sanitize . trim ( req . body . wifi_ssid ) ;
75
+ wifi_password = sanitize . trim ( req . body . wifi_password ) ;
76
+ port = sanitize . trim ( req . body . port ) ;
78
77
if ( hostname ) {
79
78
check ( hostname ) . len ( 3 , 25 ) ;
80
79
}
0 commit comments