Skip to content

Commit

Permalink
disable spam acccounts from accessing their account
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Jan 17, 2024
1 parent c305947 commit ba39dfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions applications/users.moon
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ class UsersApplication extends lapis.Application
{"password", types.valid_text}
}, (params) =>
user = assert_error Users\login params.username, params.password

if user\is_spam!
return yield_error "Spammer account disabled"

user\write_session @

import unset_register_referrer from require "helpers.referrers"
Expand Down
5 changes: 5 additions & 0 deletions models/users.moon
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ class Users extends Model
if user_session = r.session.user
if user_session.id
user = @find user_session.id

-- don't let spammers have access to account
if user and user\is_spam!
return nil

if user and user\salt! == user_session.key
user

Expand Down

0 comments on commit ba39dfc

Please sign in to comment.