Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOCI] Bot Check Fix #365

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/utils/humanity-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const humanEvents = [
class HumanityCheck {
constructor() {
// Check if a human event has been performed in the past
this.hasPerformedHumanEvent = !!store.session.get(storageKey) || false;
this.hasPerformedHumanEvent = this.getIsHumanFromSessionStorage();

// Humanity proved, remove handlers
const remove = () => {
Expand All @@ -39,6 +39,11 @@ class HumanityCheck {
}
}

// Helper function to grab the human variable from session storage
getIsHumanFromSessionStorage() {
return !!store.session.get(storageKey) || false;
}

// Return boolean indicating if user is a bot
// ...if it has a bot-like useragent
// ...or uses webdriver
Expand All @@ -53,7 +58,7 @@ class HumanityCheck {
}

// If the user hasn't performed a human event, it indicates it is a bot
if (!this.hasPerformedHumanEvent) {
if (!this.getIsHumanFromSessionStorage()) {
return true;
}

Expand Down
Loading