From 70b84c2cfc760ee70135cd444bc6515152292dd5 Mon Sep 17 00:00:00 2001 From: Morgan Estes Date: Thu, 13 Oct 2016 22:03:44 -0500 Subject: [PATCH 1/2] Add Clortho package for password handling --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index da64da3..5e67023 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,9 @@ "grunt": ">=0.4.0" }, "dependencies": { - "request": "~2.69.0", + "clortho": "^1.2.2", "inquirer": "~0.12.0", + "request": "~2.69.0", "underscore": "~1.8.3", "underscore.string": "~3.3.4", "xmlrpc": "^1.3.1" From 8c0e3423fdd929b8d1c0d57955d5f8962f472450 Mon Sep 17 00:00:00 2001 From: Morgan Estes Date: Thu, 13 Oct 2016 22:03:59 -0500 Subject: [PATCH 2/2] Add password management for ticket uploads Uses the Clortho NPM package to securely save username and password for authentication when uploading patches. If a username doesn't have a password saved, it will prompt to save it using either native dialog boxes, or the CLI. Afterwards, the user will be prompted for a WP.org username, and the saved password will be automatically used without further prompting. --- tasks/patch_wordpress.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tasks/patch_wordpress.js b/tasks/patch_wordpress.js index df60116..3838fee 100644 --- a/tasks/patch_wordpress.js +++ b/tasks/patch_wordpress.js @@ -19,6 +19,7 @@ var request = require( 'request' ) , patch = require( '../lib/patch.js' ) , regex = require( '../lib/regex.js' ) , xmlrpc = require('xmlrpc') + , clortho = require( 'clortho' ) _.str = _.str = require('underscore.string') _.mixin( _.str.exports() ) @@ -333,12 +334,19 @@ module.exports = function(grunt) { }) } inquirer.prompt( - [ - { type: 'input', name: 'username', message: 'Enter your WordPress.org username' }, - { type: 'password', name: 'password', message: 'Enter your WordPress.org password' } - ], - function(answers) { - uploadPatchWithCredentials( answers.username, answers.password ) + [{ + type: 'input', + name: 'username', + message: 'Enter your WordPress.org username' + }], + function( answers ) { + clortho({ + service: 'WordPress.org Trac', + username: answers.username, + message: 'Enter your WordPress.org password:' + }).then( function( credential ) { + uploadPatchWithCredentials( credential.username, credential.password ) + }); } ) })