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

Throw errors if the token/link cannot be created

Oliver Güntherd1a6fc031e6a
diff --git a/app/services/users/login_service.rb b/app/services/users/login_service.rb
index 70a46826b69..2461aaee8f0 100644
--- a/app/services/users/login_service.rb
+++ b/app/services/users/login_service.rb
@@ -63,7 +63,7 @@ module Users
return unless Setting::Autologin.enabled?
# generate a key and set cookie if autologin
- token = Token::AutoLogin.create(user:, data: token_session_information)
+ token = Token::AutoLogin.create!(user:, data: token_session_information)
cookie_options = {
value: token.plain_value,
# The autologin expiry is checked on validating the token
@@ -81,7 +81,7 @@ module Users
def assign_autologin_session(token_id)
session_id = ::Sessions::UserSession.where(session_id: session.id.private_id).pick(:id)
- ::Sessions::AutologinSessionLink.create(token_id:, session_id:)
+ ::Sessions::AutologinSessionLink.create!(token_id:, session_id:)
end
def successful_login