From 2bf2f9476aff3b3bde96e8ef7a2e8da993aa27f2 Mon Sep 17 00:00:00 2001 From: Jyri-Petteri Paloposki Date: Thu, 18 Jul 2024 22:34:04 +0300 Subject: [PATCH] Fix a few user creation errors to be prettier --- app/controllers/users_controller.rb | 4 +++- config/locales/en.yml | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 30b63172..159449f8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -81,13 +81,15 @@ class UsersController < ApplicationController end unless params['approve_tos'] == 'on' || SITE_CONFIG['tos_link'].blank? - render_failure "You have to accept the terms of service to sign up!" + notify :error, t('users.tos_error') + redirect_to signup_path return end user = User.new(user_params) unless user.valid? + notify :error, t('users.create_error') redirect_to signup_path return end diff --git a/config/locales/en.yml b/config/locales/en.yml index 9b8efd03..102f3863 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1281,6 +1281,7 @@ en: change_password_title: TRACKS::Change password choose_password: Choose password confirm_password: Confirm password + create_error: User creation failed, maybe you already have an account here? desired_login: Desired login destroy_confirmation: 'Warning: this will delete user ''%{login}'', all their actions, contexts, project and notes. Are you sure that you want to continue?' @@ -1315,6 +1316,7 @@ en: signup_successful: Signup successful for user %{username}. successfully_deleted_user: Successfully deleted user %{username} tos_link: read the Terms of Service + tos_error: You have to accept the terms of service to sign up! total_actions: Total actions total_contexts: Total contexts total_notes: Total notes