Skip Lockable reset_failed_attempts! on read-only replicas

What does this MR do and why?

Fixes #619456 (closed).

On a Geo secondary, sessionless auth on /api/v4/geo/node_proxy/:id/graphql fires Devise Lockable's reset_failed_attempts!, which issues an UPDATE against the read-only replica and raises PG::ReadOnlySqlTransaction, failing every request when failed_attempts > 0.

This overrides User#reset_failed_attempts! to no-op on read-only connections, matching the existing increment_failed_attempts! guard (and the Trackable fix in gitlab-org/gitlab-ee#4972).

Testing

Adds #reset_failed_attempts! specs in spec/models/user_spec.rb covering the read-write and read-only cases.

Backport candidate: severity::2, reported on 19.2.4.

Merge request reports

Loading
Loading