def change_password(self):
        private_key_path = os.path.join(self.key_handler.keys_dir, self.key_handler.private_key_name)
        config_path = os.path.join(cwd, u"config.data")

        old_pass = verify_password("Enter old password")
        new_pass = verify_password("Enter new password")

        # Start private key password change
        self.file_crypt.new_file(private_key_path)
        success = self.file_crypt.change_password(old_pass, new_pass)
        if success is False:
            input("Password is not correct. Press Enter to return")
            self()
        self.file_crypt.new_file(config_path)
        success = self.file_crypt.change_password(old_pass, new_pass)
        input("Password change complete. Press enter to continue.")
        self()
Exemple #2
0
    def change_password(self):
        private_key_path = os.path.join(self.key_handler.keys_dir,
                                        self.key_handler.private_key_name)
        config_path = os.path.join(cwd, u'config.data')

        old_pass = verify_password('Enter old password')
        new_pass = verify_password('Enter new password')

        # Start private key password change
        self.file_crypt.new_file(private_key_path)
        success = self.file_crypt.change_password(old_pass, new_pass)
        if success is False:
            input('Password is not correct. Press Enter to return')
            self()
        self.file_crypt.new_file(config_path)
        success = self.file_crypt.change_password(old_pass, new_pass)
        input('Password change complete. Press enter to continue.')
        self()
    def initial_setup(self):
        log.debug(u'Starting initial setup')
        self.display_menu_header(u'Setup Assistant')
        self.display_msg(u'Let\'s begin...')

        self.config.APP_NAME = get_correct_answer(u'Please enter app name',
                                                  required=True)

        self.config.COMPANY_NAME = get_correct_answer(u'Please enter your '
                                                      'company or name',
                                                      required=True)

        self.config.DEV_DATA_DIR = cwd

        url = get_correct_answer(u'Enter a url to ping for updates.',
                                 required=True)
        self.config.UPDATE_URLS = [url]
        while 1:
            answer = ask_yes_no(u'Would you like to add another '
                                'url for backup?', default='no')
            if answer is True:
                url = get_correct_answer(u'Enter another url.',
                                         required=True)
                self.config.UPDATE_URLS.append(url)
            else:
                break

        self.config.UPDATE_PATCHES = ask_yes_no(u'Would you like to enable '
                                                'patch updates?',
                                                default='yes')

        answer1 = ask_yes_no(u'Would you like to add scp settings?',
                             default='no')

        answer2 = ask_yes_no(u'Would you like to add S3 settings?',
                             default='no')

        if answer1:
            self.config.REMOTE_DIR = get_correct_answer(u'Enter remote dir',
                                                        required=True)
            self.config.HOST = get_correct_answer(u'Enter host', required=True)

            self.config.USERNAME = get_correct_answer(u'Enter usernmae',
                                                      required=True)

            key_path = get_correct_answer(u'Enter path to ssh key',
                                          required=True)
            # Path to private key
            self.config.PASSWORD = _directory_fixer(key_path)

        if answer2:
            self.config.USERNAME = get_correct_answer(u'Enter access key ID',
                                                      required=True)
            self.config.PASSWORD = get_correct_answer(u'Enter secret '
                                                      'Access Key',
                                                      required=True)

            self.config.REMOTE_DIR = get_correct_answer(u'Enter bucket name',
                                                        required=True)

        password = verify_password(u'Enter password')
        self.file_crypt._update_timer()
        self.save_config(self.config, password)
        self.package_handler.setup()
        print(u'Making keys...')
        self.keys_menu.make_keys()
        self.display_menu_header(u'Setup Complete')
        self.display_msg(u'Now let\'s update some apps')
        time.sleep(3)
    def initial_setup(self):
        log.debug(u'Starting initial setup')
        self.display_menu_header(u'Setup Assistant')
        self.display_msg(u'Let\'s begin...')

        self.config.APP_NAME = get_correct_answer(u'Please enter app name',
                                                  required=True)

        self.config.COMPANY_NAME = get_correct_answer(
            u'Please enter your '
            'company or name', required=True)

        self.config.DEV_DATA_DIR = cwd

        url = get_correct_answer(u'Enter a url to ping for updates.',
                                 required=True)
        self.config.UPDATE_URLS = [url]
        while 1:
            answer = ask_yes_no(
                u'Would you like to add another '
                'url for backup?',
                default='no')
            if answer is True:
                url = get_correct_answer(u'Enter another url.', required=True)
                self.config.UPDATE_URLS.append(url)
            else:
                break

        self.config.UPDATE_PATCHES = ask_yes_no(
            u'Would you like to enable '
            'patch updates?', default='yes')

        answer1 = ask_yes_no(u'Would you like to add scp settings?',
                             default='no')

        answer2 = ask_yes_no(u'Would you like to add S3 settings?',
                             default='no')

        if answer1:
            self.config.REMOTE_DIR = get_correct_answer(u'Enter remote dir',
                                                        required=True)
            self.config.HOST = get_correct_answer(u'Enter host', required=True)

            self.config.USERNAME = get_correct_answer(u'Enter usernmae',
                                                      required=True)

            key_path = get_correct_answer(u'Enter path to ssh key',
                                          required=True)
            # Path to private key
            self.config.PASSWORD = _directory_fixer(key_path)

        if answer2:
            self.config.USERNAME = get_correct_answer(u'Enter access key ID',
                                                      required=True)
            self.config.PASSWORD = get_correct_answer(
                u'Enter secret '
                'Access Key', required=True)

            self.config.REMOTE_DIR = get_correct_answer(u'Enter bucket name',
                                                        required=True)

        password = verify_password(u'Enter password')
        self.file_crypt._update_timer()
        self.save_config(self.config, password)
        self.package_handler.setup()
        print(u'Making keys...')
        self.keys_menu.make_keys()
        self.display_menu_header(u'Setup Complete')
        self.display_msg(u'Now let\'s update some apps')
        time.sleep(3)