def _post(self): username = self.request.get("username") email = self.request.get("email") model = UserModel(verified=False) model.assign(self) if model.validate(): if config.get_config("user_email_confirm") == "yes": model.put() user_confirm.send_confirmation_mail(username, email) values = { "message": _(u"""An email that contains the link to activate the account \ has been sent to the email"""), "redirect": None, } return self.render("noticepage", values) else: model.verified = True user_key = model.put() rbac.add_role(user_key, rbac.default_role("registered")) values = { "message": _(u"""Successfully registered."""), "redirect": None, } return self.render("noticepage", values) else: values = { "model": model } return self.render("admin_user_add", values)
def perform_installation(*args, **kwds): # Set up Role-based Access Control install_rbac() q = UserModel.query(UserModel.username == "admin").get() if not q: model = UserModel( username="******", display_name=_("Admin"), password="******", email="*****@*****.**", verified=True ) model.put(force_validation=False) rbac.add_role(model.key, rbac.default_role("super_admin")) # Configurations for item in config_setup.default_configs(): config.update_config(item.name, item.value, item.visible)
def perform_installation(*args, **kwds): #Set up Role-based Access Control install_rbac(); q = UserModel.query(UserModel.username=="admin").get() if not q: model = UserModel(username="******", password="******", email="*****@*****.**", verified=True) model.put(force_validation=False) rbac.add_role(model.key, rbac.default_role("super_admin")) #Configurations conf = [ ("site_name", "Name", True), ("session_secret_key", utils.generate_random_string(30), False), ("admin_email", "*****@*****.**", True), ("user_email_confirm", "no", True), ] for item in conf: config.update_config(item[0], item[1], item[2])