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 for user edit bug => Issue #58 #79

Merged
merged 3 commits into from Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion app/controllers/application_controller.rb
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

before_action :set_locale
before_action :configure_permitted_parameters, if: :devise_controller?

private

Expand All @@ -14,4 +14,11 @@ def default_url_options(options = {})
logger.debug "default_url_options is passed options: #{options.inspect}\n"
{ locale: I18n.locale }
end

protected

def configure_permitted_parameters
devise_parameter_sanitizer.permit(:account_update, keys: [:company_name, :owner_name, :phone, :diamond_price_in_cents])
end

end
19 changes: 18 additions & 1 deletion app/views/devise/registrations/edit.html.erb
Expand Up @@ -15,6 +15,23 @@
label_html: { class: "form-label label-small" },
input_html: { autocomplete: "email", class: 'form-text' } %>
</div>
<div class="form-group">
<%= f.input :password,
label_html: { class: "form-label label-small" },
input_html: { autocomplete: "new-password", class: 'form-text' } %>
</div>
<div class="form-group">
<%= f.input :password_confirmation,
label_html: { class: "form-label label-small" },
input_html: { autocomplete: "new-password", class: 'form-text' } %>
</div>
<div class="form-group">
<%= f.input :current_password,
required: true,
label_html: { class: "form-label label-small" },
input_html: { autocomplete: "current-password", class: 'form-text' } %>
<i class="form-label label-small my-1">(we need your current password to confirm your changes)</i>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add this text to I18n ?

https://github.com/vczb/gamou/tree/main/config/locales

create a new key on config/locales/en/en.yml and add this text like this

I18n.t('my.new.key')

its necessary replicate add this content on pt-BR locale too config/locales/pt-BR/pt-BR.yml with te content

"Precisamos de sua senha atual para confirmar suas alterações"

If you need help im available

</div>
<div class="form-group">
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
Expand All @@ -24,7 +41,7 @@
<%= f.input :company_name,
required: true,
label_html: { class: "form-label label-small" },
input_html: { class: 'form-text' } %>
input_html: { class: 'form-text' } %>
</div>
<div class="form-group">
<%= f.input :owner_name,
Expand Down