简体   繁体   中英

Change flash message on devise password change

I am changing my password and the flash message is showing "You are already signed in." and I want to show "You password is changed successfully.

I have searched what to do and one recommendation was to use i8n but I am looking for an alternate solution

My edit.html.erb is given as:

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, id:'edit-pwd-profile' }) do |f| %>
        <%= devise_error_messages! %>

        <div class="form-group">
            <%= f.label :current_password %>
            <%= f.password_field :current_password, autocomplete: "current-password", class: "form-control" %>
        </div>

        <div class="form-group">
            <%= f.label :password %>
            <%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
        </div>

        <div class="form-group">
            <%= f.label :password_confirmation %><br />
            <%= f.password_field :password_confirmation, autocomplete: "new-password" , class: "form-control"%>
        </div>

        <div class="actions form-group">
            <%= f.submit "Update", class: 'btn btn-primary' %>
        </div>
    <% end %>

I expect "Your password is changed successfully" Actual output is "You are already signed in."

You can create your own config/devise.en.yml

update flash messages by taking reference from /home/<username>/.rvm/gems/<ruby-version>/gems/devise-<version-installed>/config/locales/en.yml

If you do not want to show flash message / remove it, just provide key with blank value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM