# except ImportError: # pass from tgext.pluggable import plug plug(base_config, 'tgext.mailer') plug(base_config, 'registration', global_models=True) plug(base_config, 'tgext.evolve', global_models=True, evolutions=evolutions) from ksweb.config.registration_hooks import RegistrationHooks RegistrationHooks.register(base_config) plug(base_config, 'resetpassword', reset_password_form='ksweb.lib.forms.ResetPasswordForm', new_password_form='ksweb.lib.forms.NewPasswordForm') from tgext.pluggable import replace_template replace_template(base_config, 'resetpassword.templates.index', 'ksweb.templates.resetpassword.index') plug(base_config, 'tgextodt') plug(base_config, 'userprofile') replace_template(base_config, 'registration.templates.register', 'ksweb.templates.registration.register') replace_template(base_config, 'userprofile.templates.index', 'ksweb.templates.userprofile.index') def replace_profile_form_layout(): from axf.bootstrap import BootstrapFormLayout from userprofile.lib import UserForm from userprofile.lib import ChangePasswordForm UserForm.child = BootstrapFormLayout(children=UserForm.child.children)
# -> string.Template instance used as the flash template when rendered from server side, will receive $container_id, $message and $status variables. # flash.js_call -> javascript code which will be run when displaying the flash from javascript. Default is webflash.render(), you can use webflash.payload() to retrieve the message and show it with your favourite library. # flash.js_template -> string.Template instance used to replace full javascript support for flash messages. When rendering flash message for javascript usage the following code will be used instead of providing the standard webflash object. If you replace js_template you must also ensure cookie parsing and delete it for already displayed messages. The template will receive: $container_id, $cookie_name, $js_call variables. base_config['templating.genshi.name_constant_patch'] = True # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "3283411b-1904-4554-b0e1-883863b53080" # INFO - This is the way to specialize the resetpassword email properties # plug(base_config, 'resetpassword', None, mail_subject=reset_password_email_subject) plug(base_config, 'resetpassword', 'reset_password') replace_template(base_config, 'resetpassword.templates.index', 'tracim.templates.reset_password_index') replace_template(base_config, 'resetpassword.templates.change_password', 'mako:tracim.templates.reset_password_change_password') daemons = DaemonsManager() def start_daemons(manager: DaemonsManager): """ Sart Tracim daemons """ from tg import config cfg = CFG.get_instance() # Don't start daemons if they are disabled if config.get('disable_daemons', False): return
# managing login and logout of your application base_config.sa_auth.form_plugin = None # You may optionally define a page where you want users to be redirected to # on login: base_config.sa_auth.post_login_url = '/post_login' # You may optionally define a page where you want users to be redirected to # on logout: base_config.sa_auth.post_logout_url = '/post_logout' # INFO - This is the way to specialize the resetpassword email properties # plug(base_config, 'resetpassword', None, mail_subject=reset_password_email_subject) plug(base_config, 'resetpassword', 'reset_password') replace_template(base_config, 'resetpassword.templates.index', 'tracim.templates.reset_password_index') replace_template(base_config, 'resetpassword.templates.change_password', 'mako:tracim.templates.reset_password_change_password') # Note: here are fake translatable strings that allow to translate messages for reset password email content duplicated_email_subject = l_('Password reset request') duplicated_email_body = l_(''' We've received a request to reset the password for this account. Please click this link to reset your password: %(password_reset_link)s If you no longer wish to make the above change, or if you did not initiate this request, please disregard and/or delete this e-mail. ''') ####### #