Mercurial > kallithea
diff rhodecode/lib/db_manage.py @ 597:53128b6b9a4d rhodecode-0.0.1.0.0rc4
added password validation, second try on paster setup-app,
docs update, and fixed beaker cache settings in ini files.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 12 Oct 2010 23:17:25 +0200 |
parents | 000b675e7c1d |
children | 7e536d1af60d |
line wrap: on
line diff
--- a/rhodecode/lib/db_manage.py Tue Oct 12 22:27:10 2010 +0200 +++ b/rhodecode/lib/db_manage.py Tue Oct 12 23:17:25 2010 +0200 @@ -56,7 +56,6 @@ log.info('checking for existing db in %s', db_path) if os.path.isfile(db_path): self.db_exists = True - log.info('database exist') if not override: raise Exception('database already exists') @@ -65,7 +64,7 @@ Create a auth database """ self.check_for_db(override) - if override: + if self.db_exists: log.info("database exist and it's going to be destroyed") if self.tests: destroy = True @@ -79,15 +78,33 @@ meta.Base.metadata.create_all(checkfirst=checkfirst) log.info('Created tables for %s', self.dbname) - def admin_prompt(self): + def admin_prompt(self, second=False): if not self.tests: import getpass + + + def get_password(): + password = getpass.getpass('Specify admin password (min 6 chars):') + confirm = getpass.getpass('Confirm password:') + + if password != confirm: + log.error('passwords mismatch') + return False + if len(password) < 6: + log.error('password is to short use at least 6 characters') + return False + + return password + username = raw_input('Specify admin username:') - password = getpass.getpass('Specify admin password:') - confirm = getpass.getpass('Confirm password:') - if password != confirm: - log.error('passwords mismatch') - sys.exit() + + password = get_password() + if not password: + #second try + password = get_password() + if not password: + sys.exit() + email = raw_input('Specify admin email:') self.create_user(username, password, email, True) else: