1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00

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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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