Commit 112559b0 authored by David Lucadou's avatar David Lucadou

Fixing CI failure for Devise two factor

parent cdb8a636
......@@ -211,7 +211,14 @@ class RegistrationsController < Devise::RegistrationsController
# User is on the enable TOTP page
if user.otp_secret.nil?
# User is going to enable TOTP
user.otp_secret = User.generate_otp_secret
user.otp_secret = User.generate_otp_secret(32)
# In Gitlab CI, without adding the length of 32, it will cause
# an ArgumentError that the key must be 32 bytes.
# By default, devise-two-factor uses 24, so this overrides it
# and prevents this error.
# This error only occurs in Gitlab CI - not in dev, prod, or when
# running gitlab-runner locally. I have no idea why, but this
# should prevent CI test failures.
user.otp_verification_timeout = DateTime.now() + 5.minutes
user.save!
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment