File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
const fs = require ( 'fs' )
2
2
, Syncano = require ( 'syncano' )
3
+ , validator = require ( 'validator' ) ;
3
4
;
4
5
5
6
module . exports = function ( FASTACK ) {
@@ -24,10 +25,21 @@ module.exports = function(FASTACK) {
24
25
}
25
26
] , function ( answers ) {
26
27
var fastack = new Syncano ( { instance : 'fastack' , apiKey : FASTACK . apiKey } ) ;
27
- fastack . user ( ) . add ( {
28
- username : answers . username ,
29
- password : answers . password
30
- } ) ;
28
+ var responses = { username : answers . username , email : answers . email , password : answers . password }
29
+
30
+ if ( answers . email && validator . isEmail ( answers . email ) ) {
31
+ fastack . user ( ) . add ( responses ) . then ( function ( ) {
32
+ FASTACK . logger . log ( "Account created." ) ;
33
+ callback ( ) ;
34
+ } , function ( err ) {
35
+ FASTACK . logger . log ( "Error info: " + err ) ;
36
+ callback ( ) ;
37
+ } ) ;
38
+ } else {
39
+ FASTACK . logger . log ( "Not a valid e-mail address. Please try again." ) ;
40
+ callback ( ) ;
41
+ }
42
+
31
43
} ) ;
32
44
}
33
45
} ;
You can’t perform that action at this time.
0 commit comments