From 2de47411701e0590ebe89471008fd677b259d0f1 Mon Sep 17 00:00:00 2001 From: Walter Date: Sat, 7 Nov 2015 22:21:07 -0500 Subject: [PATCH] Add password confirmation, hide password and set default database seed to no --- app/commands/AppCommand.php | 39 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/app/commands/AppCommand.php b/app/commands/AppCommand.php index 362054a4aa..5f50499bb4 100755 --- a/app/commands/AppCommand.php +++ b/app/commands/AppCommand.php @@ -222,12 +222,23 @@ class AppCommand extends Command { do { // Ask the user to input the user password - $password = $this->ask('Please enter your user password (at least 8 characters): '); + $password = $this->secret('Please enter your user password (at least 8 characters): '); + $password1 = $this->secret('Please confirm your user password: '); // Check if password is valid - if ($password == '') { + if ($password == '' || $password1 == '') { // Return an error message $this->error('Password is invalid. Please try again.'); + $password = ''; + $password1 = ''; + } + else{ + // Verify the user password + if ($password != $password1){ + $this->error('Password do not match. Please try again.'); + $password = ''; + $password1 = ''; + } } // Store the password @@ -235,19 +246,19 @@ class AppCommand extends Command } while( ! $password); } - /** - * Asks the user to create dummy data - * - * @return void - * @todo Use the Laravel Validator - */ - protected function askUserDummyData() - { - // Ask the user to input the user password - $dummydata = $this->ask('Do you want to seed your database with dummy data? Y/n (default is yes): '); + /** + * Asks the user to create dummy data + * + * @return void + * @todo Use the Laravel Validator + */ + protected function askUserDummyData() + { + // Ask the user to input the user password + $dummydata = $this->ask('Do you want to seed your database with dummy data? y/N (default is no): '); - $this->dummyData = ( strstr($dummydata, 'Y' ) || empty($dummydata) ) ? true : false; - } + $this->dummyData = ( strstr($dummydata, 'N' ) || empty($dummydata) ) ? true : false; + } /** * Runs all the necessary Sentry commands.