users: lock out users with invalid names until they change their name.

Forcibly redirect users to the name change page if their name is
invalid. This means user with invalid names can't do anything or view
any pages until they change their name. API requests are still allowed.
This commit is contained in:
evazion
2022-03-07 04:21:17 -06:00
parent 1028bb1c71
commit 525acd17a5
3 changed files with 12 additions and 3 deletions

View File

@@ -76,13 +76,12 @@ class ApplicationControllerTest < ActionDispatch::IntegrationTest
end
context "when a user has an invalid username" do
should "show a warning banner" do
should "redirect to the name change page" do
@user = create(:user)
@user.update_columns(name: "foo__bar")
get_auth posts_path, @user
assert_response :success
assert_select "#invalid-name-notice"
assert_redirected_to new_user_name_change_request_path
end
end