def attempt_register(): data = request.json result_dict = User.create_new({"username": data["username"], "password": data["password"]}) if result_dict["success"]: # Copy over all of the starter resources for the new user repository_user = User.get_user_by_username("repository") new_user = User.get_user_by_username(data["username"]) for res_type in res_types: starters = repository_user.get_resource_names(res_type, tag_filter="starter") for rname in starters: copy_between_accounts(repository_user, new_user, res_type, rname, rname) return jsonify(result_dict)
def attempt_login(): data = request.json result_dict = {} user = User.get_user_by_username(data["username"]) if user is not None and user.verify_password(data["password"]): login_user(user, remember=data["remember_me"]) result_dict["logged_in"] = True else: result_dict["logged_in"] = False return jsonify(result_dict)
def direct_collection(collection_name, username, password): user = User.get_user_by_username(username) if user is not None and user.verify_password(password): login_user(user, remember=False) return redirect(url_for("main", collection_name=collection_name))
def validate_username(self, field): if User.get_user_by_username(field.data): raise ValidationError('Username already in use.')
def direct_project(project_name, username, password): user = User.get_user_by_username(username) if user is not None and user.verify_password(password): login_user(user, remember=False) return redirect(url_for("main_project", project_name=project_name))
def direct_administer(password): user = User.get_user_by_username("repository") if user is not None and user.verify_password(password): login_user(user, remember=False) return redirect(url_for("admin_interface"))
def direct_creator(module_name, username, password): user = User.get_user_by_username(username) if user is not None and user.verify_password(password): login_user(user, remember=False) return redirect(url_for("view_in_creator", module_name=module_name))
def direct_user_manage(username, password): user = User.get_user_by_username(username) if user is not None and user.verify_password(password): login_user(user, remember=False) return redirect(url_for("user_manage"))
for (category, the_dict) in user_tiles[current_user.username].items(): loaded_tiles += the_dict.keys() return render_template("user_manage/loaded_tile_list.html", user_tile_name_list=loaded_tiles) def request_update_loaded_tile_list(self): return self.render_loaded_tile_list() class RepositoryTileManager(TileManager): rep_string = "repository-" is_repository = True def add_rules(self): pass repository_user = User.get_user_by_username("repository") list_manager = ListManager("list") repository_list_manager = RepositoryListManager("list") collection_manager = CollectionManager("collection") repository_collection_manager = RepositoryCollectionManager("collection") project_manager = ProjectManager("project") repository_project_manager = RepositoryProjectManager("project") tile_manager = TileManager("tile") repository_tile_manager = RepositoryTileManager("tile") @app.route('/user_manage')