Commit Graph

1443 Commits

Author SHA1 Message Date
evazion
b2ee1f0766 ip bans: add hit counter, deleted flag, new ban type.
* Make IP bans soft deletable.
* Add a hit counter to track how many times an IP ban has blocked someone.
* Add a last hit timestamp to track when the IP ban last blocked someone.
* Add a new type of IP ban, the signup ban. Signup bans restrict new
  signups from editing anything until they've verified their email
  address.
2020-04-06 14:13:22 -05:00
evazion
8773c7e87f Merge pull request #4369 from BrokenEagle/post-version-fixes
Various post version fixes
2020-04-04 02:55:37 -05:00
evazion
8134e92457 user deletions: fix error when given incorrect password.
Use validations instead of raising an exception when the password is
incorrect so that the controller can display errors sensibly.

Also fix users being logged out even when the deletion attempt failed
due to an incorrect password.
2020-04-03 23:44:23 -05:00
evazion
300b8bdefc user deletions: add confirmation dialog. 2020-04-03 23:44:02 -05:00
evazion
dc0442bd17 bans: redirect to index page after creating new ban. 2020-04-03 15:39:14 -05:00
evazion
34337b0eb5 popular posts: fix exception when given blank date param.
Flexbooru calls this endpoint with a blank date param.
2020-03-31 21:57:34 -05:00
evazion
3051daf5eb password resets: fix exception when given user does not exist. 2020-03-31 21:57:34 -05:00
evazion
25776a062c posts/random: fix pundit exception when no post is found. 2020-03-31 21:57:34 -05:00
evazion
e0a72ef135 tests: add more controller tests.
* Fix an exception in /artists/show_or_new.
2020-03-31 19:00:32 -05:00
evazion
a272453bd0 wikis: redirect legacy title param to show page.
Redirect /wiki_pages?title=touhou to /wiki_pages/touhou.
2020-03-31 18:13:41 -05:00
evazion
81488c7608 controllers: declare search_params helper in app controller. 2020-03-31 18:10:27 -05:00
evazion
919a2868be Fix #4374: Unvoting comments is broken. 2020-03-28 21:15:51 -05:00
BrokenEagle
6aa0adb738 Make the post versions more like the old format
- "Current" is now most like the old format
-- It is therefore now the default for post versions
- Only show the actual edits in their own column
- Show the current state at that version in another column
- On the "previous" view, don't double-show full list of tags for
  the first post versions, so leave edits blank
2020-03-28 06:29:41 +00:00
evazion
d24c746417 Fix #4360: Something broke random=true.
When random mode is enabled @post_set.posts returns an array, which
caused `authorize` to try to lookup the wrong policy.

This only happens when `authorize` is given an array with more than one
element, which is why it wasn't caught by the tests.
2020-03-27 04:23:32 -05:00
evazion
b2cf765d6d users: refactor login and authentication logic.
* Make authentication methods into User instance methods instead of
  class methods.
* Fix API key authentication to use a secure string comparison. Fixes a
  hypothetical (unlikely to be exploitable) timing attack.
* Move login logic from SessionCreator to SessionLoader.
2020-03-25 18:48:43 -05:00
evazion
9e455695a1 sessions: remove legacy user_name / password_hash cookies.
Remove support for logging in with the deprecated user_name /
password_hash cookies. Followup to 320ff01e0.
2020-03-25 18:48:43 -05:00
evazion
b7bd6c8fdd users: require email verification for signups from proxies.
Require users who signup using proxies to verify their email addresses
before they can perform any edits. For verification purposes, the email
must be a nondisposable address from a whitelist of trusted email
providers.
2020-03-24 17:25:35 -05:00
evazion
5faa323729 users: clean up password update logic.
Pull the password reauthentication logic out of the user model and put
it in the password update controller where it belongs.

This fixes an issue where when a new user was created the user model had
an incorrect password error set on it by `encrypt_password_on_update`.
It was trying to verify the old password even though we don't have one
when creating a new user. This error caused the user create action to
redirect back to the signup page because `respond_with` thought that
creating the user failed.
2020-03-24 17:25:35 -05:00
evazion
0ad5619484 pundit: add missing authorize calls. 2020-03-24 00:38:07 -05:00
evazion
4a5bec71f6 signup: don't send welcome emails to invalid addresses.
Fix attempting to send welcome emails when user didn't provide a valid
email address.
2020-03-24 00:26:47 -05:00
evazion
e79910431f emails: validate that email addresses are deliverable.
Reject email addresses that known to be undeliverable during signup.
Some users signup with invalid email addresses, which causes the welcome
email (which contains the email confirmation link) to bounce. Too many
bounces hurt our ability to send mail.

We check that an email address is undeliverable by checking if the
domain has a mail server and if the server returns an invalid address
error when attempting to send mail. This isn't foolproof since some
servers don't return an error if the address doesn't exist. If the
checks fail we know the address is bad, but if the checks pass that
doesn't guarantee the address is good. However, this is still good
enough to filter out bad addresses for popular providers like Gmail and
Microsoft that do return nonexistent address errors.

The address existence check requires being able to connect to mail
servers over port 25. This may fail if your network blocks port 25,
which many home ISPs and hosting providers do by default.
2020-03-23 23:45:18 -05:00
evazion
f23df47c09 ip addresses: add ip address show page.
* Add IP address show page at /ip_addresses/1.2.3.4.
* Add "Details", "Ban IP", "Ban User" options to the /ip_addresses listing.
2020-03-23 01:48:59 -05:00
evazion
41ab3c9f63 post versions: fix undo action. 2020-03-21 23:06:42 -05:00
evazion
d775c625bb application controller: remove role_only! methods. 2020-03-20 18:03:50 -05:00
evazion
7f742242e4 pundit: convert uploads to pundit. 2020-03-20 18:03:01 -05:00
evazion
d51b0dfe17 pundit: convert moderator/post/posts to pundit. 2020-03-20 18:03:01 -05:00
evazion
1344d4c161 pundit: convert moderator/dashboard to pundit.
Make it visible to everyone since there's no non-public information here.
2020-03-20 18:03:01 -05:00
evazion
a5418abb31 pundit: convert posts to pundit. 2020-03-20 18:03:01 -05:00
evazion
dd39913e55 pundit: convert post replacements to pundit. 2020-03-20 18:03:01 -05:00
evazion
3bb3c0b990 pundit: convert saved searches to pundit. 2020-03-20 18:03:01 -05:00
evazion
415d9591c5 pundit: convert post votes to pundit.
Side effects:

* The data-current-user-is-voter <body> attribute has been removed.
* {{upvote:self}} no longer works. {{upvote:<name>}} should be used instead.
2020-03-20 18:03:01 -05:00
evazion
33d81d0d1b pundit: convert post flags to pundit. 2020-03-20 18:03:01 -05:00
evazion
ffae64f127 pundit: convert post versions to pundit. 2020-03-20 18:03:01 -05:00
evazion
ba0a5dda8a pundit: convert post disapprovals to pundit. 2020-03-20 18:03:01 -05:00
evazion
84c654464d pundit: convert post approvals to pundit. 2020-03-20 18:03:01 -05:00
evazion
cbee23f9ad pundit: convert post appeals to pundit. 2020-03-20 18:03:01 -05:00
evazion
ab5432d149 pundit: convert pools to pundit. 2020-03-20 18:03:01 -05:00
evazion
83eae1bf11 pundit: convert passwords to pundit. 2020-03-20 18:03:01 -05:00
evazion
62835ac9fc pundit: convert notes to pundit. 2020-03-20 18:03:01 -05:00
evazion
2c4c29b81a pundit: convert favorite groups to pundit. 2020-03-20 18:03:01 -05:00
evazion
50fa674a3e pundit: convert emails to pundit. 2020-03-20 18:03:01 -05:00
evazion
a440c56ed8 pundit: convert comment votes to pundit. 2020-03-20 18:03:01 -05:00
evazion
ce1133dd69 pundit: convert artist commentaries to pundit. 2020-03-20 18:03:01 -05:00
evazion
3d83c3154e pundit: convert forum topic visits to pundit. 2020-03-20 18:03:01 -05:00
evazion
f1f489c40b pundit: convert favorites to pundit. 2020-03-20 18:03:01 -05:00
evazion
cc2b4abd09 pundit: convert forum post votes to pundit. 2020-03-20 18:03:01 -05:00
evazion
be59e85d25 pundit: convert ip addresses to pundit. 2020-03-20 18:03:01 -05:00
evazion
92aeb8728f pundit: convert ip bans to pundit. 2020-03-20 18:03:01 -05:00
evazion
9242bf522b pundit: convert moderation reports to pundit. 2020-03-20 18:03:01 -05:00
evazion
480f39c34a pundit: convert dmails to pundit. 2020-03-20 18:03:01 -05:00