Skip to content

Commit

Permalink
validate registration email address
Browse files Browse the repository at this point in the history
increased version to 0.7
  • Loading branch information
grob committed Jun 29, 2014
1 parent 3d92b21 commit bf8308f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/commands/createuser.js
@@ -1,5 +1,6 @@
var term = require("ringo/term");
var shell = require("ringo/shell");
var strings = require("ringo/utils/strings");
var registry = require("../utils/registry");
var {proceed} = require("../utils/shell");

Expand All @@ -9,7 +10,6 @@ exports.help = function() {
term.writeln("\n" + exports.description, "\n");
term.writeln("Usage:");
term.writeln(" rp createuser\n");
return;
};

exports.createuser = function() {
Expand All @@ -31,7 +31,13 @@ exports.createuser = function() {
term.writeln(term.BOLD, "\nPasswords do not match, please try again.\n", term.RESET);
}
}
var email = shell.readln("Email: ");
while (!email) {
email = shell.readln("Email address: ").trim();
if (email && !strings.isEmail(email)) {
term.writeln(term.BOLD, "Invalid email address", term.RESET);
email = null;
}
}
term.writeln("\nA registry account will be created using the following information:\n");
term.writeln(" Username:", term.BOLD, username, term.RESET);
term.writeln(" Email:", term.BOLD, email, term.RESET);
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "rp",
"version": "0.6",
"version": "0.7",
"description": "A package manager for RingoJS",
"keywords": ["package manager", "ringojs", "modules"],
"homepage": "https://github.com/grob/rp/",
Expand Down

0 comments on commit bf8308f

Please sign in to comment.