Skip to content
Browse files

[fix] Better support for fully qualified app names. Added missing err…

…or callback. Added better contextual help for accounts confirmations.
  • Loading branch information...
1 parent 371732c commit ea5f2184193c30ecb90e3b3bc15d99d5b14a9aec @Marak Marak committed Nov 18, 2011
Showing with 32 additions and 20 deletions.
  1. +18 −16 lib/jitsu/commands/apps.js
  2. +10 −4 lib/jitsu/commands/users.js
  3. +4 −0 lib/jitsu/properties.js
View
34 lib/jitsu/commands/apps.js
@@ -166,7 +166,7 @@ apps.create = function (target, callback) {
}
pkg.name = name || pkg.name;
- jitsu.apps.list(function (err, apps) {
+ jitsu.apps.list(jitsu.config.get('username'), function (err, apps) {
if (err) {
return callback(err);
}
@@ -338,13 +338,19 @@ apps.view.usage = [
//
apps.update = function (name, callback) {
- if(name.search('/') === -1){
- name = jitsu.config.get('username') + '/' + name;
+ if(typeof name === 'function') {
+ callback = name;
+ name = "";
}
winston.silly('Reading package.json in ' + process.cwd());
jitsu.package.tryRead(process.cwd(), callback, function (pkg) {
name = name || pkg.name;
+
+ if(name.search('/') === -1){
+ name = jitsu.config.get('username') + '/' + name;
+ }
+
jitsu.apps.view(name, function (err, app) {
if (err) {
return callback(err);
@@ -428,13 +434,11 @@ apps.destroy.usage = [
//
apps.start = function (name, callback) {
- if(name.search('/') === -1){
- name = jitsu.config.get('username') + '/' + name;
- }
-
- console.log(name);
function executeStart() {
winston.info('Starting app ' + name.magenta);
+ if(name.search('/') === -1){
+ name = jitsu.config.get('username') + '/' + name;
+ }
jitsu.apps.start(name, function (err) {
if (err) {
return callback(err, true);
@@ -483,12 +487,11 @@ apps.start.usage = [
//
apps.restart = function (name, callback) {
- if(name.search('/') === -1){
- name = jitsu.config.get('username') + '/' + name;
- }
-
function executeRestart() {
winston.info('Restarting app ' + name.magenta);
+ if(name.search('/') === -1){
+ name = jitsu.config.get('username') + '/' + name;
+ }
jitsu.apps.restart(name, function (err) {
if (err) {
return callback(err);
@@ -530,12 +533,11 @@ apps.restart.usage = [
//
apps.stop = function (name, callback) {
- if(name.search('/') === -1){
- name = jitsu.config.get('username') + '/' + name;
- }
-
function executeStop() {
winston.info('Stopping app ' + name.magenta);
+ if(name.search('/') === -1){
+ name = jitsu.config.get('username') + '/' + name;
+ }
jitsu.apps.stop(name, function (err) {
if (err) {
return callback(err);
View
14 lib/jitsu/commands/users.js
@@ -172,22 +172,29 @@ users.confirm = function (username, callback) {
if (err) {
return callback(err);
}
+
if (response.error) {
winston.error(response.error);
+ return callback(response.error);
}
else if (!response.hasPassword) {
(function getNewPass() {
- jitsu.prompt.get(['password', 'confirm password'], function (err, results) {
+
+ winston.help('Now that your account is confirmed, you will need to set a password.');
+ winston.help('In the future, you can also reset your password by running the' + ' jitsu users forgot'.magenta + ' command');
+ winston.help('Set your new password below');
+
+ jitsu.prompt.get(['set password', 'confirm password'], function (err, results) {
if (err) {
return callback(err);
}
- if (results['password'] !== results['confirm password']) {
+ if (results['set password'] !== results['confirm password']) {
winston.error('The provided passwords do not match.');
return getNewPass();
}
jitsu.users.forgot(username, {
shake: response.shake,
- 'new-password': results.password
+ 'new-password': results['set password']
}, function (err, res) {
return err ? callback(err) : callback(null, res);
});
@@ -198,7 +205,6 @@ users.confirm = function (username, callback) {
winston.info('User ' + username.magenta + ' confirmed');
}
- callback();
});
});
};
View
4 lib/jitsu/properties.js
@@ -17,6 +17,10 @@ properties.properties = {
name: 'password',
hidden: true
},
+ 'set password': {
+ name: 'set password',
+ hidden: true
+ },
'confirm password': {
name: 'confirm password',
hidden: true

0 comments on commit ea5f218

Please sign in to comment.
Something went wrong with that request. Please try again.