Disable email requirement for admins

This commit is contained in:
rubenwardy
2025-08-26 19:29:17 +01:00
parent 038e65bfe3
commit 394b1fe33d
2 changed files with 2 additions and 2 deletions

View File

@@ -325,7 +325,7 @@ def handle_create_edit(package: typing.Optional[Package], form: PackageForm, aut
@bp.route("/packages/<author>/<name>/edit/", methods=["GET", "POST"]) @bp.route("/packages/<author>/<name>/edit/", methods=["GET", "POST"])
@login_required @login_required
def create_edit(author=None, name=None): def create_edit(author=None, name=None):
if current_user.email is None: if current_user.email is None and not current_user.rank.at_least(UserRank.ADMIN):
flash(gettext("You must add an email address to your account and confirm it before you can manage packages"), "danger") flash(gettext("You must add an email address to your account and confirm it before you can manage packages"), "danger")
return redirect(url_for("users.email_notifications")) return redirect(url_for("users.email_notifications"))

View File

@@ -85,7 +85,7 @@ class EditPackageReleaseForm(FlaskForm):
@login_required @login_required
@is_package_page @is_package_page
def create_release(package): def create_release(package):
if current_user.email is None: if current_user.email is None and not current_user.rank.at_least(UserRank.ADMIN):
flash(gettext("You must add an email address to your account and confirm it before you can manage packages"), "danger") flash(gettext("You must add an email address to your account and confirm it before you can manage packages"), "danger")
return redirect(url_for("users.email_notifications")) return redirect(url_for("users.email_notifications"))