int PasswordService::delayForNextAttempt(const User& user) const { if (attemptThrottling_) { int throttlingNeeded = getPasswordThrottle(user.failedLoginAttempts()); if (throttlingNeeded) { WDateTime t = user.lastLoginAttempt(); int diff = t.secsTo(WDateTime::currentDateTime()); if (diff < throttlingNeeded) return throttlingNeeded - diff; else return 0; } else return 0; } else return 0; }