Marcin Kuzminski avatar Marcin Kuzminski committed 53128b6

added password validation, second try on paster setup-app,
docs update, and fixed beaker cache settings in ini files.

Comments (0)

Files changed (6)

 ####################################
 ###         BEAKER CACHE        ####
 ####################################
- beaker.cache.data_dir=/%(here)s/data/cache/data
- beaker.cache.lock_dir=/%(here)s/data/cache/lock
- beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
- beaker.cache.long_term.type=memory
- beaker.cache.long_term.expire=36000
+beaker.cache.data_dir=/%(here)s/data/cache/data
+beaker.cache.lock_dir=/%(here)s/data/cache/lock
+beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 
- beaker.cache.short_term.type=memory
- beaker.cache.short_term.expire=60
+beaker.cache.super_short_term.type=memory
+beaker.cache.super_short_term.expire=10
 
- beaker.cache.super_short_term.type=memory
- beaker.cache.super_short_term.expire=10
- 
- beaker.cache.sql_cache_short.type=memory
- beaker.cache.sql_cache_short.expire=5
- 
- beaker.cache.sql_cache_med.type=memory
- beaker.cache.sql_cache_med.expire=360
- 
- beaker.cache.sql_cache_long.type=file
- beaker.cache.sql_cache_long.expire=3600
+beaker.cache.short_term.type=memory
+beaker.cache.short_term.expire=60
+
+beaker.cache.long_term.type=memory
+beaker.cache.long_term.expire=36000
+
+beaker.cache.sql_cache_short.type=memory
+beaker.cache.sql_cache_short.expire=5
+
+beaker.cache.sql_cache_med.type=memory
+beaker.cache.sql_cache_med.expire=360
+
+beaker.cache.sql_cache_long.type=file
+beaker.cache.sql_cache_long.expire=3600
 
 ####################################
 ###       BEAKER SESSION        ####

docs/changelog.rst

 - fixed python2.5 missing simplejson imports (thanks to Jens Bäckman)
 - removed cache_manager settings from sqlalchemy meta
 - added sqlalchemy cache settings to ini files
+- validated password length and added second try of failure on paster setup-app
+- fixed setup database destroy prompt even when there was no db
+
 
 1.0.0rc3 (**2010-10-11**)
 
 
 ::
 
- paster setup-app production.ini` 
+ paster setup-app production.ini
 
 - This command will create all needed tables and an admin account. 
   When asked for a path You can either use a new location of one with already 
 ####################################
 ###         BEAKER CACHE        ####
 ####################################
- beaker.cache.data_dir=/%(here)s/data/cache/data
- beaker.cache.lock_dir=/%(here)s/data/cache/lock
- beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
- beaker.cache.long_term.type=memory
- beaker.cache.long_term.expire=36000
+beaker.cache.data_dir=/%(here)s/data/cache/data
+beaker.cache.lock_dir=/%(here)s/data/cache/lock
+beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 
- beaker.cache.short_term.type=memory
- beaker.cache.short_term.expire=60
+beaker.cache.super_short_term.type=memory
+beaker.cache.super_short_term.expire=10
 
- beaker.cache.super_short_term.type=memory
- beaker.cache.super_short_term.expire=10
- 
- beaker.cache.sql_cache_short.type=memory
- beaker.cache.sql_cache_short.expire=5
- 
- beaker.cache.sql_cache_med.type=memory
- beaker.cache.sql_cache_med.expire=360
- 
- beaker.cache.sql_cache_long.type=file
- beaker.cache.sql_cache_long.expire=3600
+beaker.cache.short_term.type=memory
+beaker.cache.short_term.expire=60
+
+beaker.cache.long_term.type=memory
+beaker.cache.long_term.expire=36000
+
+beaker.cache.sql_cache_short.type=memory
+beaker.cache.sql_cache_short.expire=5
+
+beaker.cache.sql_cache_med.type=memory
+beaker.cache.sql_cache_med.expire=360
+
+beaker.cache.sql_cache_long.type=file
+beaker.cache.sql_cache_long.expire=3600
 
 ####################################
 ###       BEAKER SESSION        ####

rhodecode/config/deployment.ini_tmpl

 ####################################
 ###         BEAKER CACHE        ####
 ####################################
- beaker.cache.data_dir=/%(here)s/data/cache/data
- beaker.cache.lock_dir=/%(here)s/data/cache/lock
- beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
- beaker.cache.long_term.type=memory
- beaker.cache.long_term.expire=36000
+beaker.cache.data_dir=/%(here)s/data/cache/data
+beaker.cache.lock_dir=/%(here)s/data/cache/lock
+beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 
- beaker.cache.short_term.type=memory
- beaker.cache.short_term.expire=60
+beaker.cache.super_short_term.type=memory
+beaker.cache.super_short_term.expire=10
 
- beaker.cache.super_short_term.type=memory
- beaker.cache.super_short_term.expire=10
- 
- beaker.cache.sql_cache_short.type=memory
- beaker.cache.sql_cache_short.expire=5
- 
- beaker.cache.sql_cache_med.type=memory
- beaker.cache.sql_cache_med.expire=360
- 
- beaker.cache.sql_cache_long.type=file
- beaker.cache.sql_cache_long.expire=3600
+beaker.cache.short_term.type=memory
+beaker.cache.short_term.expire=60
+
+beaker.cache.long_term.type=memory
+beaker.cache.long_term.expire=36000
+
+beaker.cache.sql_cache_short.type=memory
+beaker.cache.sql_cache_short.expire=5
+
+beaker.cache.sql_cache_med.type=memory
+beaker.cache.sql_cache_med.expire=360
+
+beaker.cache.sql_cache_long.type=file
+beaker.cache.sql_cache_long.expire=3600
 
 ####################################
 ###       BEAKER SESSION        ####

rhodecode/lib/db_manage.py

         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')
 
         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
         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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.