def change_password(login, passw=None): """[-login] LOGIN [-passw] NEW_PASSWORD Changes the password of an existing user.""" from bundles.users import auth if passw is None: passw = prompt_pass('>>> Password? ') password_minlen = auth.settings.password_minlen while len(passw) < password_minlen: print 'Password is too short (min %i chars).' % password_minlen passw = prompt_pass('>>> Password? ') auth.change_password(login, passw) print 'Changed the password of user `%s`.' % login.encode('utf8')
def create_user(login, passw, **data): """[-login] LOGIN [-passw] PASSWORD Creates a new user. """ from bundles.users import auth password_minlen = auth.settings.password_minlen while len(passw) < password_minlen: print 'Password is too short (min %i chars).' % password_minlen passw = prompt_pass('>>> Password? ') auth.create_user(login, passw, **data) print 'Created user `%s` with password `%s`.' % (login, passw) print 'To change the password use `manage.py change_password %s`' % login print 'To change the email use `manage.py update_user %s email=mynew@email`' % login