Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix flash message #485

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/web/devise/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ class Web::Devise::RegistrationsController < Devise::RegistrationsController
private

def check_captcha
I18n.locale = session[:locale]
return if verify_recaptcha

self.resource = resource_class.new sign_up_params
resource.validate
resource.errors.add(:base, t('recaptcha.errors.verification_failed')) unless resource.errors.any?
resource.errors.add(:base, t('recaptcha.errors.verification_failed', locale: I18n.locale)) unless resource.errors.any?
set_minimum_password_length
respond_with_navigational(resource) do
f(:recaptcha_error, discard: true)
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/confirmations/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h2
= t('.resend_confirmation_instructions')
= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
= f.error_notification
= f.error_notification message: t('devise.correct_errors')
= f.full_error :confirmation_token
.form-inputs
= f.input :email, required: true, autofocus: true,
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/passwords/edit.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h2
= t('.change_your_password')
= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
= f.error_notification
= f.error_notification message: t('devise.correct_errors')
= f.input :reset_password_token, as: :hidden
= f.full_error :reset_password_token
.form-inputs
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/passwords/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h2
= t('.forgot_your_password')
= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
= f.error_notification
= f.error_notification message: t('devise.correct_errors')
.form-inputs
= f.input :email, required: true, autofocus: true, input_html: { autocomplete: 'email' }
.form-actions
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/edit.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h2
= t('.title', resource: resource.model_name.human)
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
= f.error_notification
= f.error_notification message: t('devise.correct_errors')
.form-inputs
= f.input :email, required: true, autofocus: true
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h2
= t('.sign_up')
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= f.error_notification
= f.error_notification message: t('devise.correct_errors')
.form-inputs
.mb-3
= f.input :email, required: true, autofocus: true, input_html: { autocomplete: 'email' }
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/unlocks/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h2
= t('.resend_unlock_instructions')
= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
= f.error_notification
= f.error_notification message: t('devise.correct_errors')
= f.full_error :unlock_token
.form-inputs
= f.input :email, required: true, autofocus: true, input_html: { autocomplete: 'email' }
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/devise.html.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
doctype html
html.h-100 lang="en"
html.h-100 lang="#{I18n.locale}"
head
= render 'layouts/shared/head'
body.d-flex.flex-column.h-100
Expand Down
1 change: 1 addition & 0 deletions config/locales/devise.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

en:
devise:
correct_errors: "please, correct the mistakes:"
failure:
user:
banned: "You have been banned"
Expand Down
4 changes: 4 additions & 0 deletions config/locales/devise.ru.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ru:
devise:
correct_errors: "Пожалуйста, исправьте ошибки:"
failure:
user:
banned: "Вы были забанены"
not_found_in_database: Не верный логин или пароль.
invalid: Не правильный логин или пароль.
unauthenticated: Вам необходимо войти в систему или зарегистрироваться.
1 change: 1 addition & 0 deletions config/locales/en.activerecord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ en:
name: Name
company: Company
user:
password: password
resume_answer_likes_count: Likes
first_name: First name
last_name: Surname
Expand Down
1 change: 1 addition & 0 deletions config/locales/ru.activerecord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ru:
answer/comment: Комментарий
attributes:
user:
password: пароль
resume_answer_likes_count: Количество лайков
first_name: Имя
last_name: Фамилия
Expand Down