# Path: lib/Settings.py
# class Settings:
#     def __init__(self,
#                  override_settings_path='settings.cfg'):
#         self.settingsFilePath = override_settings_path
#         self.parser = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
#         self.settings = None
#         self.getSettings()
# 
#     def getSettings(self):
#         self.parser.read('./settings.cfg')
#         self.settings = {section: dict(**self.parser[section]) for section in self.parser.sections()}
# 
#         return self.settings
# 
#     def getServiceIp(self, service):
#         return self.settings['general']['my_ip']


import getpass
from lib.Settings import Settings


class UserInformation:

    def __init__(self):
        self.settings = Settings().getSettings()
        self.user = None
        self.firstname = None
        self.surname = None
        self.password = None
        self.repassword = None
        self.domain = None
        self.email = None

    def get_user_info(self):
        print("\nLet's create a user...")
        self.user = input('Username: ')
        self.firstname = input('Firstname: ')
        self.surname = input('Surname: ')
        if not self.surname:
            self.surname = 'default'
        self.password = getpass.getpass('Password: ')
        self.repassword = getpass.getpass('Reenter password: ')
        while self.password != self.repassword:
            print('Password does not match, try again...')
            self.password = getpass.getpass('Password: ')
            self.repassword = getpass.getpass('Reenter password: ')


# Path: lib/Settings.py
# class Settings:
#     def __init__(self,
#                  override_settings_path='settings.cfg'):
#         self.settingsFilePath = override_settings_path
#         self.parser = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
#         self.settings = None
#         self.getSettings()
# 
#     def getSettings(self):
#         self.parser.read('./settings.cfg')
#         self.settings = {section: dict(**self.parser[section]) for section in self.parser.sections()}
# 
#         return self.settings
# 
#     def getServiceIp(self, service):
#         return self.settings['general']['my_ip']


# Path: lib/UserInformation.py
import getpass
from lib.Settings import Settings



class UserInformation:

    def __init__(self):
        self.settings = Settings().getSettings()
        self.user = None
        self.firstname = None
        self.surname = None
        self.password = None
        self.repassword = None
        self.domain = None
        self.email = None

    def get_user_info(self):
        print("\nLet's create a user...")
        self.user = input('Username: ')
        self.firstname = input('Firstname: ')
        self.surname = input('Surname: ')
        if not self.surname:
            self.surname = 'default'
        self.password = getpass.getpass('Password: ')
        self.repassword = getpass.getpass('Reenter password: ')
        while self.password != self.repassword:
            print('Password does not match, try again...')
            self.password = getpass.getpass('Password: ')
            self.repassword = getpass.getpass('Reenter password: ')


        self.domain = input('Domain (default ' + self.settings['general']['default_domain'] + '): ')