Skip to content

Commit 27152f0

Browse files
Merge pull request #11927 from nextcloud/bugfix/noid/show-warning-when-bfp-more-than-5s
feat(UX): Show a warning when bruteforce protection is throttling
2 parents 7655023 + 6fd87cb commit 27152f0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/services/participantsService.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
*/
2222

2323
import axios from '@nextcloud/axios'
24+
import {
25+
showWarning
26+
} from '@nextcloud/dialogs'
2427
import {
2528
generateOcsUrl,
2629
} from '@nextcloud/router'
@@ -48,6 +51,20 @@ const joinConversation = async ({ token, forceJoin = false }, options) => {
4851
force: forceJoin,
4952
}, options)
5053

54+
if (response.headers.get('X-Nextcloud-Bruteforce-Throttled')) {
55+
console.error(
56+
'Remote address is bruteforce throttled: '
57+
+ response.headers.get('X-Nextcloud-Bruteforce-Throttled')
58+
+ ' (Request ID: ' + response.headers.get('X-Request-ID') + ')'
59+
)
60+
const throttleMs = parseInt(response.headers.get('X-Nextcloud-Bruteforce-Throttled'), 10)
61+
if (throttleMs > 5000) {
62+
showWarning(
63+
t('spreed', 'Your requests are throttled at the moment due to brute force protection')
64+
)
65+
}
66+
}
67+
5168
// FIXME Signaling should not be synchronous
5269
await signalingJoinConversation(token, response.data.ocs.data.sessionId)
5370

0 commit comments

Comments
 (0)