MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / SetNeedCaptcha

Method SetNeedCaptcha

core/init/auth/ip_tracker.go:69–92  ·  view source on GitHub ↗
(ip string)

Source from the content-addressed store, hash-verified

67}
68
69func (t *IPTracker) SetNeedCaptcha(ip string) {
70 t.mu.Lock()
71 defer t.mu.Unlock()
72
73 if record, exists := t.records[ip]; exists {
74 if !t.prepareRecordUnsafe(ip, record) {
75 t.removeIPUnsafe(ip)
76 } else {
77 record.NeedCaptcha = true
78 record.LastUpdate = time.Now()
79 return
80 }
81 }
82
83 if len(t.records) >= MaxIPCount {
84 t.removeOldestUnsafe()
85 }
86
87 t.records[ip] = &IPRecord{
88 NeedCaptcha: true,
89 LastUpdate: time.Now(),
90 }
91 t.ipOrder = append(t.ipOrder, ip)
92}
93
94func (t *IPTracker) RecordFailure(ip string) {
95 t.mu.Lock()

Callers 3

LoginMethod · 0.80
MFALoginMethod · 0.80
PasskeyFinishLoginMethod · 0.80

Calls 3

prepareRecordUnsafeMethod · 0.95
removeIPUnsafeMethod · 0.95
removeOldestUnsafeMethod · 0.95

Tested by

no test coverage detected