Commit 240b1657 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Update code copied from Devise

This was changed upstream to fix a vulnerability
parent b7652b57
...@@ -1420,14 +1420,13 @@ class User < ApplicationRecord ...@@ -1420,14 +1420,13 @@ class User < ApplicationRecord
# flow means we don't call that automatically (and can't conveniently do so). # flow means we don't call that automatically (and can't conveniently do so).
# #
# See: # See:
# <https://github.com/plataformatec/devise/blob/v4.0.0/lib/devise/models/lockable.rb#L92> # <https://github.com/plataformatec/devise/blob/v4.7.1/lib/devise/models/lockable.rb#L104>
# #
# rubocop: disable CodeReuse/ServiceClass # rubocop: disable CodeReuse/ServiceClass
def increment_failed_attempts! def increment_failed_attempts!
return if ::Gitlab::Database.read_only? return if ::Gitlab::Database.read_only?
self.failed_attempts ||= 0 increment_failed_attempts
self.failed_attempts += 1
if attempts_exceeded? if attempts_exceeded?
lock_access! unless access_locked? lock_access! unless access_locked?
......
---
title: Update incrementing of failed logins to be thread-safe
merge_request: 19614
author:
type: security
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