<s> from . _base import Config <EOL> from synapse . util . stringutils import random_string_with_symbols <EOL> from distutils . util import strtobool <EOL> class RegistrationConfig ( Config ) : <EOL> def read_config ( self , config ) : <EOL> self . enable_registration = bool ( <EOL> strtobool ( str ( config [ "<STR_LIT>" ] ) ) <EOL> ) <EOL> if "<STR_LIT>" in config : <EOL> self . enable_registration = not bool ( <EOL> strtobool ( str ( config [ "<STR_LIT>" ] ) ) <EOL> ) <EOL> self . registration_shared_secret = config . get ( "<STR_LIT>" ) <EOL> self . bcrypt_rounds = config . get ( "<STR_LIT>" , <NUM_LIT:12> ) <EOL> self . trusted_third_party_id_servers = config [ "<STR_LIT>" ] <EOL> self . allow_guest_access = config . get ( "<STR_LIT>" , False ) <EOL> self . invite_3pid_guest = ( <EOL> self . allow_guest_access and config . get ( "<STR_LIT>" , False ) <EOL> ) <EOL> def default_config ( self , ** kwargs ) : <EOL> registration_shared_secret = random_string_with_symbols ( <NUM_LIT:50> ) <EOL> return """<STR_LIT>""" % locals ( ) <EOL> def add_arguments ( self , parser ) : <EOL> reg_group = parser . add_argument_group ( "<STR_LIT>" ) <EOL> reg_group . add_argument ( <EOL> "<STR_LIT>" , action = "<STR_LIT:store_true>" , default = None , <EOL> help = "<STR_LIT>" <EOL> ) <EOL> def read_arguments ( self , args ) : <EOL> if args . enable_registration is not None : <EOL> self . enable_registration = bool ( <EOL> strtobool ( str ( args . enable_registration ) ) <EOL> ) </s>
