Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add user validation on token

Oliver Günther9f028b49ddbd
diff --git a/app/models/token/base.rb b/app/models/token/base.rb
index 415cd6ca11b..b7aa526928d 100644
--- a/app/models/token/base.rb
+++ b/app/models/token/base.rb
@@ -51,8 +51,8 @@ module Token
self.table_name = "tokens"
serialize :data, coder: ::Serializers::IndifferentHashSerializer
- # Hashed tokens belong to a user and are unique per type
- belongs_to :user
+ # Tokens belong to a user and are unique per type
+ belongs_to :user, optional: false
# Create a plain and hashed value when creating a new token
after_initialize :initialize_values