anti spam
This commit is contained in:
parent
ee27f483c2
commit
76dbe9fcf9
@ -60,6 +60,9 @@ router.get('/', (_req, res) => {
|
||||
const recent_posters = []
|
||||
|
||||
router.post('/comment', (req, res) => {
|
||||
if (req.body.checkbox === "on"){
|
||||
return res.redirect('/home#visitor_table')
|
||||
}
|
||||
const ip = req.header('x-forwarded-for') || req.connection.remoteAddress;
|
||||
if(recent_posters.some( poster => poster.ip === ip)){
|
||||
console.log("spammer, " + ip)
|
||||
|
@ -327,6 +327,9 @@
|
||||
<textarea placeholder="きき 機器 危機 聞き 気気 キキ 木木" name="comment"></textarea>
|
||||
<br>
|
||||
<br>
|
||||
<input name="checkbox" checked class="checkbox" type="checkbox"><label>Don't check</label>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user