Browse Source

Use saturating add

pull/6411/head
Daniel García 3 months ago
parent
commit
3cdb557455
No known key found for this signature in database GPG Key ID: FC8A7D14C3CD543A
  1. 2
      src/api/core/two_factor/email.rs
  2. 2
      src/api/core/two_factor/protected_actions.rs

2
src/api/core/two_factor/email.rs

@ -286,7 +286,7 @@ impl EmailTokenData {
} }
pub fn add_attempt(&mut self) { pub fn add_attempt(&mut self) {
self.attempts += 1; self.attempts = self.attempts.saturating_add(1);
} }
pub fn to_json(&self) -> String { pub fn to_json(&self) -> String {

2
src/api/core/two_factor/protected_actions.rs

@ -51,7 +51,7 @@ impl ProtectedActionData {
} }
pub fn add_attempt(&mut self) { pub fn add_attempt(&mut self) {
self.attempts += 1; self.attempts = self.attempts.saturating_add(1);
} }
pub fn time_since_sent(&self) -> TimeDelta { pub fn time_since_sent(&self) -> TimeDelta {

Loading…
Cancel
Save