Changeset 15287
- Timestamp:
- 9 Jan 2019, 21:17:08 (6 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r14949 r15287 51 51 from waeup.kofa.mandates.mandate import RefereeReportMandate 52 52 from waeup.kofa.tests.test_async import FunctionalAsyncTestCase 53 from waeup.kofa.tests.test_authentication import SECRET 53 54 54 55 PH_LEN = 15911 # Length of placeholder file … … 539 540 def init_officer(self): 540 541 # Create application officer 541 self.app['users'].addUser('mrappl', 'mrapplsecret')542 self.app['users'].addUser('mrappl', SECRET) 542 543 self.app['users']['mrappl'].email = 'mrappl@foo.ng' 543 544 self.app['users']['mrappl'].title = 'Carlo Pitter' … … 547 548 self.browser.open(self.login_path) 548 549 self.browser.getControl(name="form.login").value = 'mrappl' 549 self.browser.getControl(name="form.password").value = 'mrapplsecret'550 self.browser.getControl(name="form.password").value = SECRET 550 551 self.browser.getControl("Login").click() 551 552 -
main/waeup.kofa/trunk/src/waeup/kofa/authentication.py
r15286 r15287 280 280 # unset/empty passwords do never match 281 281 return False 282 # Do not accept password if password is insecure. 283 validator = getUtility(IPasswordValidator) 284 if validator.validate_secure_password(password, password): 285 return False 282 286 if self.suspended: 283 287 return False … … 411 415 return errors 412 416 413 def validate_secure d_password(self, pw, pw_repeat):417 def validate_secure_password(self, pw, pw_repeat): 414 418 """ 415 419 ^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{8,}$ … … 422 426 $ End anchor. 423 427 """ 428 429 # temporarily disabled 430 # /kofa/trunk/src/waeup/kofa/doctests/pages.txt line 176 not met 431 return self.validate_password(pw, pw_repeat) 432 424 433 check_pw = re.compile(r"^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{8,}$").match 425 434 errors = [] … … 427 436 errors.append(translate(_( 428 437 'Passwords must be at least 8 characters long, ' 429 ' contain at least one uppercase letter, '438 'must contain at least one uppercase letter, ' 430 439 'one lowercase letter and one digit.'))) 431 440 if pw != pw_repeat: -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r15286 r15287 430 430 return 431 431 # Display appropriate flash message if credentials are correct 432 # but officer has been deactivated. 432 # but the stored password is insecure or officer has been 433 # deactivated. 433 434 login = self.request.form['form.login'] 434 435 if login in grok.getSite()['users']: … … 438 439 if user.password is not None and \ 439 440 passwordmanager.checkPassword(user.password, password): 441 # Check first if the stored password might have 442 # been the reason 443 validator = getUtility(IPasswordValidator) 444 errors = validator.validate_secure_password( 445 password, password) 446 if errors: 447 msg1 = translate(_( 448 'Your user name and password are correct ' 449 'but your password is not considered ' 450 'secure. ')) 451 msg2 = translate(_( 452 ' Your account has been temporarily ' 453 'deactivated. ' 454 'Please request a new password.')) 455 self.flash( msg1 + ' '.join(errors) + msg2, type="danger") 456 self.redirect(self.application_url() + '/changepw') 457 return 440 458 self.flash(_('Your user name and password are correct ' 441 'but yo r account has been temporarily '459 'but your account has been temporarily ' 442 460 'deactivated.'), 443 461 type='warning') … … 859 877 if password: 860 878 validator = getUtility(IPasswordValidator) 861 errors = validator.validate_secure d_password(password, password_ctl)879 errors = validator.validate_secure_password(password, password_ctl) 862 880 if errors: 863 881 self.flash( ' '.join(errors), type='danger') … … 903 921 if password: 904 922 validator = getUtility(IPasswordValidator) 905 errors = validator.validate_secure d_password(password, password_ctl)923 errors = validator.validate_secure_password(password, password_ctl) 906 924 if errors: 907 925 self.flash( ' '.join(errors), type='danger') -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r15163 r15287 37 37 from waeup.kofa.university.faculty import Faculty 38 38 from waeup.kofa.university.department import Department 39 from waeup.kofa.tests.test_authentication import SECRET 39 40 40 41 SAMPLE_FILE = os.path.join(os.path.dirname(__file__), 'test_file.csv') … … 359 360 def test_export_accesscodes(self): 360 361 # Create portal manager and an ExportManager 361 self.app['users'].addUser('mrportal', 'mrportalsecret')362 self.app['users'].addUser('mrportal', SECRET) 362 363 self.app['users']['mrportal'].email = 'mrportal@foo.ng' 363 364 self.app['users']['mrportal'].title = 'Carlo Pitter' … … 365 366 prmlocal = IPrincipalRoleManager(self.app) 366 367 prmlocal.assignRoleToPrincipal('waeup.PortalManager', 'mrportal') 367 self.app['users'].addUser('mrexporter', 'mrexportersecret')368 self.app['users'].addUser('mrexporter', SECRET) 368 369 self.app['users']['mrexporter'].email = 'mrexporter@foo.ng' 369 370 self.app['users']['mrexporter'].title = 'Carlos Potter' … … 374 375 self.browser.open('http://localhost/app/login') 375 376 self.browser.getControl(name="form.login").value = 'mrportal' 376 self.browser.getControl(name="form.password").value = 'mrportalsecret'377 self.browser.getControl(name="form.password").value = SECRET 377 378 self.browser.getControl("Login").click() 378 379 … … 401 402 self.browser.open('http://localhost/app/login') 402 403 self.browser.getControl(name="form.login").value = 'mrexporter' 403 self.browser.getControl(name="form.password").value = 'mrexportersecret'404 self.browser.getControl(name="form.password").value = SECRET 404 405 self.browser.getControl("Login").click() 405 406 … … 501 502 login_path = 'http://localhost/app/login' 502 503 # Create officer 503 self.app['users'].addUser('officer', 'officersecret')504 self.app['users'].addUser('officer', SECRET) 504 505 self.app['users']['officer'].email = 'mrofficer@foo.ng' 505 506 self.app['users']['officer'].title = 'Carlo Pitter' … … 510 511 self.browser.open(login_path) 511 512 self.browser.getControl(name="form.login").value = 'officer' 512 self.browser.getControl(name="form.password").value = 'officersecret'513 self.browser.getControl(name="form.password").value = SECRET 513 514 self.browser.getControl("Login").click() 514 515 self.browser.open(upload_path) … … 562 563 def test_suspended_officer(self): 563 564 self.app['users'].addUser( 564 'officer', 'secret', title='Bob Officer', email='bob@abcd.ng')565 'officer', SECRET, title='Bob Officer', email='bob@abcd.ng') 565 566 # Officer can't login if their password is not set. 566 567 self.app['users']['officer'].password = None 567 568 self.browser.open('http://localhost/app/login') 568 569 self.browser.getControl(name="form.login").value = 'officer' 569 self.browser.getControl(name="form.password").value = 'secret'570 self.browser.getControl(name="form.password").value = SECRET 570 571 self.browser.getControl("Login").click() 571 572 self.assertTrue( … … 573 574 # We set the password again. 574 575 IUserAccount( 575 self.app['users']['officer']).setPassword( 'secret')576 self.app['users']['officer']).setPassword(SECRET) 576 577 # Officers can't login if their account is suspended/deactivated. 577 578 self.app['users']['officer'].suspended = True 578 579 self.browser.open('http://localhost/app/login') 579 580 self.browser.getControl(name="form.login").value = 'officer' 580 self.browser.getControl(name="form.password").value = 'secret'581 self.browser.getControl(name="form.password").value = SECRET 581 582 self.browser.getControl("Login").click() 582 583 self.assertMatches( 583 '...but yo r account has been temporarily deactivated...',584 '...but your account has been temporarily deactivated...', 584 585 self.browser.contents) 585 586 # Officer is really not logged in. … … 588 589 self.browser.open('http://localhost/app/login') 589 590 self.browser.getControl(name="form.login").value = 'officer' 590 self.browser.getControl(name="form.password").value = 'secret'591 self.browser.getControl(name="form.password").value = SECRET 591 592 self.browser.getControl("Login").click() 592 593 # Yeah, officer logged in. … … 618 619 config = grok.getSite()['configuration'] 619 620 self.app['users'].addUser( 620 'officer', 'secret', title='Bob Officer', email='bob@abcd.ng')621 'officer', SECRET, title='Bob Officer', email='bob@abcd.ng') 621 622 self.browser.open('http://localhost/app/login') 622 623 self.browser.getControl(name="form.login").value = 'officer' 623 self.browser.getControl(name="form.password").value = 'secret'624 self.browser.getControl(name="form.password").value = SECRET 624 625 self.browser.getControl("Login").click() 625 626 # Officer logged in. … … 636 637 # Officers really can't login if maintenance mode is enabled. 637 638 self.browser.getControl(name="form.login").value = 'officer' 638 self.browser.getControl(name="form.password").value = 'secret'639 self.browser.getControl(name="form.password").value = SECRET 639 640 self.browser.getControl("Login").click() 640 641 # A second warning is raised. … … 645 646 config.maintmode_enabled_by = u'officer' 646 647 self.browser.getControl(name="form.login").value = 'officer' 647 self.browser.getControl(name="form.password").value = 'secret'648 self.browser.getControl(name="form.password").value = SECRET 648 649 self.browser.getControl("Login").click() 649 650 self.assertTrue('You logged in' in self.browser.contents) -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_permissions.py
r14526 r15287 37 37 remove_logger) 38 38 from waeup.kofa.tests.test_async import FunctionalAsyncTestCase 39 39 from waeup.kofa.tests.test_authentication import SECRET 40 40 41 41 … … 157 157 def testReportsPermissions(self): 158 158 # Create reports officer 159 self.app['users'].addUser('mrofficer', 'mrofficer')159 self.app['users'].addUser('mrofficer', SECRET) 160 160 self.app['users']['mrofficer'].email = 'mrofficer@foo.ng' 161 161 self.app['users']['mrofficer'].title = 'Otto Report' … … 163 163 prmglobal.assignRoleToPrincipal('waeup.ReportsOfficer', 'mrofficer') 164 164 # Create reports manager 165 self.app['users'].addUser('mrmanager', 'mrmanager')165 self.app['users'].addUser('mrmanager', SECRET) 166 166 self.app['users']['mrmanager'].email = 'mrmanager@foo.ng' 167 167 self.app['users']['mrmanager'].title = 'Manfred Report' … … 171 171 self.browser.open('http://localhost/app/login') 172 172 self.browser.getControl(name="form.login").value = 'mrofficer' 173 self.browser.getControl(name="form.password").value = 'mrofficer'173 self.browser.getControl(name="form.password").value = SECRET 174 174 self.browser.getControl("Login").click() 175 175 self.trigger_report_creation('2004') … … 184 184 self.browser.open('http://localhost/app/login') 185 185 self.browser.getControl(name="form.login").value = 'mrmanager' 186 self.browser.getControl(name="form.password").value = 'mrmanager'186 self.browser.getControl(name="form.password").value = SECRET 187 187 self.browser.getControl("Login").click() 188 188 self.trigger_report_creation('2005') … … 199 199 self.browser.open('http://localhost/app/login') 200 200 self.browser.getControl(name="form.login").value = 'mrofficer' 201 self.browser.getControl(name="form.password").value = 'mrofficer'201 self.browser.getControl(name="form.password").value = SECRET 202 202 self.browser.getControl("Login").click() 203 203 self.browser.open('http://localhost/app/reports') -
main/waeup.kofa/trunk/src/waeup/kofa/doctests/authentication.txt
r12951 r15287 30 30 terms) with a password (and optional a title or description): 31 31 32 >>> root['app']['users'].addUser('bob', 'bob secret',32 >>> root['app']['users'].addUser('bob', 'bobSecret1', 33 33 ... title='Bob', description='A sample user') 34 34 … … 186 186 187 187 >>> browser.getControl(name='form.login').value = 'bob' 188 >>> browser.getControl(name='form.password').value = 'bob secret'188 >>> browser.getControl(name='form.password').value = 'bobSecret1' 189 189 >>> browser.getControl('Login').click() 190 190 -
main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
r15286 r15287 649 649 """ 650 650 651 def validate_secure d_password(self, pw, pw_repeat):651 def validate_secure_password(self, pw, pw_repeat): 652 652 """ Validates a password by comparing it with 653 653 control password and checks password strength by -
main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py
r13990 r15287 34 34 from waeup.kofa.mandates.mandate import PasswordMandate, RefereeReportMandate 35 35 from waeup.kofa.testing import (FunctionalLayer, FunctionalTestCase) 36 from waeup.kofa.tests.test_authentication import SECRET 36 37 37 38 class MandatesContainerTestCase(FunctionalTestCase): … … 123 124 124 125 def test_set_officer_password(self): 125 self.app['users'].addUser('bob', 'bobssecret')126 self.app['users'].addUser('bob', SECRET) 126 127 officer = self.app['users']['bob'] 127 128 mandate = PasswordMandate() 128 129 mandate.params['user'] = officer 129 mandate.params['password'] = 'mypwd1'130 mandate.params['password'] = SECRET 130 131 self.app['mandates'].addMandate(mandate) 131 132 (msg, redirect_path) = mandate.execute() … … 134 135 'Password has been successfully set. Login with your new password.') 135 136 self.assertEqual(redirect_path, '/login') 136 self.assertTrue(IUserAccount(officer).checkPassword( 'mypwd1'))137 self.assertTrue(IUserAccount(officer).checkPassword(SECRET)) 137 138 logfile = os.path.join( 138 139 self.app['datacenter'].storage, 'logs', 'main.log') -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15285 r15287 53 53 from waeup.kofa.tests.test_async import FunctionalAsyncTestCase 54 54 from waeup.kofa.browser.tests.test_pdf import samples_dir 55 from waeup.kofa.tests.test_authentication import SECRET 55 56 56 57 PH_LEN = 15911 # Length of placeholder file … … 1521 1522 def init_clearance_officer(self): 1522 1523 # Create clearance officer 1523 self.app['users'].addUser('mrclear', 'mrclearsecret')1524 self.app['users'].addUser('mrclear', SECRET) 1524 1525 self.app['users']['mrclear'].email = 'mrclear@foo.ng' 1525 1526 self.app['users']['mrclear'].title = 'Carlo Pitter' … … 1543 1544 self.browser.open(self.login_path) 1544 1545 self.browser.getControl(name="form.login").value = 'mrclear' 1545 self.browser.getControl(name="form.password").value = 'mrclearsecret'1546 self.browser.getControl(name="form.password").value = SECRET 1546 1547 self.browser.getControl("Login").click() 1547 1548 … … 1702 1703 1703 1704 def test_handle_courses_by_ca(self): 1704 self.app['users'].addUser('mrsadvise', 'mrsadvisesecret')1705 self.app['users'].addUser('mrsadvise', SECRET) 1705 1706 self.app['users']['mrsadvise'].email = 'mradvise@foo.ng' 1706 1707 self.app['users']['mrsadvise'].title = u'Helen Procter' … … 1713 1714 self.browser.open(self.login_path) 1714 1715 self.browser.getControl(name="form.login").value = 'mrsadvise' 1715 self.browser.getControl(name="form.password").value = 'mrsadvisesecret'1716 self.browser.getControl(name="form.password").value = SECRET 1716 1717 self.browser.getControl("Login").click() 1717 1718 self.assertMatches('...You logged in...', self.browser.contents) … … 1851 1852 def test_find_students_in_faculties(self): 1852 1853 # Create local students manager in faculty 1853 self.app['users'].addUser('mrmanager', 'mrmanagersecret')1854 self.app['users'].addUser('mrmanager', SECRET) 1854 1855 self.app['users']['mrmanager'].email = 'mrmanager@foo.ng' 1855 1856 self.app['users']['mrmanager'].title = u'Volk Wagen' … … 1865 1866 self.browser.open(self.login_path) 1866 1867 self.browser.getControl(name="form.login").value = 'mrmanager' 1867 self.browser.getControl(name="form.password").value = 'mrmanagersecret'1868 self.browser.getControl(name="form.password").value = SECRET 1868 1869 self.browser.getControl("Login").click() 1869 1870 self.assertMatches('...You logged in...', self.browser.contents) … … 2021 2022 # StudentImpersonators can login as student 2022 2023 # Create clearance officer 2023 self.app['users'].addUser('mrofficer', 'mrofficersecret')2024 self.app['users'].addUser('mrofficer', SECRET) 2024 2025 self.app['users']['mrofficer'].email = 'mrofficer@foo.ng' 2025 2026 self.app['users']['mrofficer'].title = 'Harry Actor' … … 2030 2031 self.browser.open(self.login_path) 2031 2032 self.browser.getControl(name="form.login").value = 'mrofficer' 2032 self.browser.getControl(name="form.password").value = 'mrofficersecret'2033 self.browser.getControl(name="form.password").value = SECRET 2033 2034 self.browser.getControl("Login").click() 2034 2035 self.assertMatches('...You logged in...', self.browser.contents) … … 2128 2129 'Address line2\n\n') 2129 2130 # Create officer with both roles 2130 self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret')2131 self.app['users'].addUser('mrtranscript', SECRET) 2131 2132 self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng' 2132 2133 self.app['users']['mrtranscript'].title = 'Ruth Gordon' … … 2138 2139 self.browser.open(self.login_path) 2139 2140 self.browser.getControl(name="form.login").value = 'mrtranscript' 2140 self.browser.getControl(name="form.password").value = 'mrtranscriptsecret'2141 self.browser.getControl(name="form.password").value = SECRET 2141 2142 self.browser.getControl("Login").click() 2142 2143 self.assertMatches('...You logged in...', self.browser.contents) … … 2274 2275 notify(grok.ObjectModifiedEvent(self.student)) 2275 2276 # Create transcript officer 2276 self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret')2277 self.app['users'].addUser('mrtranscript', SECRET) 2277 2278 self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng' 2278 2279 self.app['users']['mrtranscript'].title = 'Ruth Gordon' … … 2287 2288 self.browser.open(self.login_path) 2288 2289 self.browser.getControl(name="form.login").value = 'mrtranscript' 2289 self.browser.getControl(name="form.password").value = 'mrtranscriptsecret'2290 self.browser.getControl(name="form.password").value = SECRET 2290 2291 self.browser.getControl("Login").click() 2291 2292 self.assertMatches('...You logged in...', self.browser.contents) … … 2315 2316 notify(grok.ObjectModifiedEvent(self.student)) 2316 2317 # Create transcript signee 2317 self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret')2318 self.app['users'].addUser('mrtranscript', SECRET) 2318 2319 self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng' 2319 2320 self.app['users']['mrtranscript'].title = 'Ruth Gordon' … … 2328 2329 self.browser.open(self.login_path) 2329 2330 self.browser.getControl(name="form.login").value = 'mrtranscript' 2330 self.browser.getControl(name="form.password").value = 'mrtranscriptsecret'2331 self.browser.getControl(name="form.password").value = SECRET 2331 2332 self.browser.getControl("Login").click() 2332 2333 self.assertMatches('...You logged in...', self.browser.contents) … … 4111 4112 def test_export_departmet_officers(self): 4112 4113 # Create department officer 4113 self.app['users'].addUser('mrdepartment', 'mrdepartmentsecret')4114 self.app['users'].addUser('mrdepartment', SECRET) 4114 4115 self.app['users']['mrdepartment'].email = 'mrdepartment@foo.ng' 4115 4116 self.app['users']['mrdepartment'].title = 'Carlo Pitter' … … 4121 4122 self.browser.open(self.login_path) 4122 4123 self.browser.getControl(name="form.login").value = 'mrdepartment' 4123 self.browser.getControl(name="form.password").value = 'mrdepartmentsecret'4124 self.browser.getControl(name="form.password").value = SECRET 4124 4125 self.browser.getControl("Login").click() 4125 4126 self.assertMatches('...You logged in...', self.browser.contents) … … 4145 4146 def test_export_bursary_officers(self): 4146 4147 # Create bursary officer 4147 self.app['users'].addUser('mrbursary', 'mrbursarysecret')4148 self.app['users'].addUser('mrbursary', SECRET) 4148 4149 self.app['users']['mrbursary'].email = 'mrbursary@foo.ng' 4149 4150 self.app['users']['mrbursary'].title = 'Carlo Pitter' … … 4153 4154 self.browser.open(self.login_path) 4154 4155 self.browser.getControl(name="form.login").value = 'mrbursary' 4155 self.browser.getControl(name="form.password").value = 'mrbursarysecret'4156 self.browser.getControl(name="form.password").value = SECRET 4156 4157 self.browser.getControl("Login").click() 4157 4158 self.assertMatches('...You logged in...', self.browser.contents) … … 4183 4184 def test_export_accommodation_officers(self): 4184 4185 # Create bursary officer 4185 self.app['users'].addUser('mracco', 'mraccosecret')4186 self.app['users'].addUser('mracco', SECRET) 4186 4187 self.app['users']['mracco'].email = 'mracco@foo.ng' 4187 4188 self.app['users']['mracco'].title = 'Carlo Pitter' … … 4191 4192 self.browser.open(self.login_path) 4192 4193 self.browser.getControl(name="form.login").value = 'mracco' 4193 self.browser.getControl(name="form.password").value = 'mraccosecret'4194 self.browser.getControl(name="form.password").value = SECRET 4194 4195 self.browser.getControl("Login").click() 4195 4196 self.assertMatches('...You logged in...', self.browser.contents) … … 4234 4235 4235 4236 def login_as_lecturer(self): 4236 self.app['users'].addUser('mrslecturer', 'mrslecturersecret')4237 self.app['users'].addUser('mrslecturer', SECRET) 4237 4238 self.app['users']['mrslecturer'].email = 'mrslecturer@foo.ng' 4238 4239 self.app['users']['mrslecturer'].title = u'Mercedes Benz' … … 4253 4254 self.browser.getControl(name="form.login").value = 'mrslecturer' 4254 4255 self.browser.getControl( 4255 name="form.password").value = 'mrslecturersecret'4256 name="form.password").value = SECRET 4256 4257 self.browser.getControl("Login").click() 4257 4258 # Store reused urls/paths -
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_authentication.py
r14670 r15287 40 40 IKofaPluggable) 41 41 42 SECRET = 'HgtuZZZ8' 42 43 43 44 class FakeSite(grok.Site, grok.Container): … … 133 134 self.getRootFolder()['app'] = FakeSite() 134 135 self.site = self.getRootFolder()['app'] 135 self.site['users'] = {'bob': Account('bob', 'secret')}136 self.site['users'] = {'bob': Account('bob', SECRET)} 136 137 setSite(self.site) 137 138 return … … 155 156 plugin = UserAuthenticatorPlugin() 156 157 result1 = plugin.authenticateCredentials( 157 dict(login='bob', password= 'secret'))158 dict(login='bob', password=SECRET)) 158 159 result2 = plugin.authenticateCredentials( 159 160 dict(login='bob', password='nonsense')) … … 185 186 # do `num` failed logins and a valid one afterwards 186 187 del self.site['users'] 187 self.site['users'] = {'bob': Account('bob', 'secret')}188 self.site['users'] = {'bob': Account('bob', SECRET)} 188 189 plugin = UserAuthenticatorPlugin() 189 190 resultlist = [] … … 193 194 dict(login='bob', password='wrongsecret'))) 194 195 resultlist.append(plugin.authenticateCredentials( 195 dict(login='bob', password= 'secret')))196 dict(login='bob', password=SECRET))) 196 197 return resultlist 197 198 -
main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
r14699 r15287 273 273 name.replace('-', ' - ')).replace(' - ', '-') 274 274 275 def genPassword(self, length= 8, chars=string.letters + string.digits):275 def genPassword(self, length=4, chars=string.letters + string.digits): 276 276 """Generate a random password. 277 277 """ 278 return ''.join([r().choice(chars) for i in range(length)]) 278 return ''.join([ 279 r().choice(string.uppercase) + 280 r().choice(string.lowercase) + 281 r().choice(string.digits) for i in range(length)]) 279 282 280 283 def sendCredentials(self, user, password=None, url_info=None, msg=None):
Note: See TracChangeset for help on using the changeset viewer.