from admin import content_menu _check_conf = ( # morias common block ("morias", "db", Sql), ("news", "in_menu", bool, True), ) def _call_conf(cfg, parser): if cfg.news_in_menu: user_sections.append(Item("/news", label="News")) module_rights = ("news_editor", "news_author") rights.update(module_rights) content_menu.append(Item("/admin/news", label="News", symbol="news", rights=module_rights)) @app.route("/admin/news") def admin_news(req): check_login(req) match_right(req, module_rights) show = req.args.getfirst("show", "", uni) pager = Pager(sort="desc") pager.bind(req.args) kwargs = {}
_check_conf = ( ("morias", "db", Sql), # database configuration ("morias", "smtp", Smtp), # for password reset ("login", "sign_up", bool, False), # If user could sign up # If user could get entry link when don't know password ("login", "rounds", int, 12, True, "Rounds for bcrypt gensalt."), ("login", "forget_password_link", bool, False), ("login", "ttl_of_password_link", int, 30, True, "Time to Live in minutes of forgotten password link."), ("login", "created_verify_link", bool, False, True, "If created login must verify his/her email."), ) module_right = "users_admin" # right admin - do anythig with users R_ADMIN = module_right # back compatibility rights.update((R_ADMIN,)) system_menu.append(Item("/admin/logins", label="Logins", symbol="login", rights=[R_ADMIN])) user_info_menu.append(Item("/login", label="Login", symbol="login", rights=["user"])) def _call_conf(cfg, parser): if cfg.login_sign_up: app.set_route("/sign_up", sign_up, state.METHOD_GET_POST) if cfg.login_forget_password_link: app.set_route("/login/forgotten_password", forgotten_password, state.METHOD_GET_POST) def send_login_created(req, login, sign_up=False): try: req.smtp.send_email_alternative(