fix: Only admins can generate invite codes (#1611)

* fix: Only admins can generate invite codes

* fix: raise error if user is not an admin when creating invite codesss
This commit is contained in:
Tony Vincent
2025-01-24 02:47:51 +01:00
committed by GitHub
parent 0476f25952
commit 61321f6b16
3 changed files with 22 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ class InviteCodesController < ApplicationController
end
def create
raise StandardError, "You are not allowed to generate invite codes" unless Current.user.admin?
InviteCode.generate!
redirect_back_or_to invite_codes_path, notice: "Code generated"
end