mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 06:33:28 +00:00
Merge pull request #149 from resin-io/jviotti/fix/111/email-validation
Validate that email address is valid during signup. Fix #111
This commit is contained in:
commit
8401aaeae2
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var TOKEN_URL, _, async, form, open, resin, settings, url, visuals;
|
||||
var TOKEN_URL, _, async, form, open, resin, settings, url, validEmail, visuals;
|
||||
|
||||
open = require('open');
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
validEmail = require('valid-email');
|
||||
|
||||
TOKEN_URL = url.resolve(settings.get('dashboardUrl'), '/preferences');
|
||||
|
||||
exports.login = {
|
||||
@ -106,7 +108,13 @@
|
||||
{
|
||||
message: 'Email:',
|
||||
name: 'email',
|
||||
type: 'input'
|
||||
type: 'input',
|
||||
validate: function(input) {
|
||||
if (!validEmail(input)) {
|
||||
return 'Email is not valid';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
message: 'Username:',
|
||||
name: 'username',
|
||||
|
@ -6,6 +6,7 @@ resin = require('resin-sdk')
|
||||
settings = require('resin-settings-client')
|
||||
form = require('resin-cli-form')
|
||||
visuals = require('resin-cli-visuals')
|
||||
validEmail = require('valid-email')
|
||||
|
||||
TOKEN_URL = url.resolve(settings.get('dashboardUrl'), '/preferences')
|
||||
|
||||
@ -139,6 +140,11 @@ exports.signup =
|
||||
message: 'Email:'
|
||||
name: 'email'
|
||||
type: 'input'
|
||||
validate: (input) ->
|
||||
if not validEmail(input)
|
||||
return 'Email is not valid'
|
||||
|
||||
return true
|
||||
,
|
||||
message: 'Username:'
|
||||
name: 'username'
|
||||
|
@ -61,6 +61,7 @@
|
||||
"resin-vcs": "^2.0.0",
|
||||
"selfupdate": "^1.1.0",
|
||||
"underscore.string": "^3.1.1",
|
||||
"user-home": "^2.0.0"
|
||||
"user-home": "^2.0.0",
|
||||
"valid-email": "0.0.2"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user