diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 0ae8b1e7..2382fc32 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -1,10 +1,10 @@ %h2 Resend confirmation instructions = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .field = f.label :email %br/ - = f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) + = f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) .actions = f.submit "Resend confirmation instructions" = render "devise/shared/links" diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index fc6f52d8..acaf13a4 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,6 +1,6 @@ %h2 Change your password = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.hidden_field :reset_password_token .field = f.label :password, "New password" @@ -9,7 +9,7 @@ %em (#{@minimum_password_length} characters minimum) %br/ - = f.password_field :password, autofocus: true, autocomplete: "off" + = f.password_field :password, autofocus: true, autocomplete: "new-password" .field = f.label :password_confirmation, "Confirm new password" %br/ diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 9add188d..60984ffa 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,10 +1,10 @@ %h2 Forgot your password? = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .field = f.label :email %br/ - = f.email_field :email, autofocus: true + = f.email_field :email, autofocus: true, autocomplete: "email" .actions = f.submit "Send me reset password instructions" = render "devise/shared/links" diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 09789dee..5dd45ec9 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,11 +1,11 @@ %h2 Edit #{resource_name.to_s.humanize} = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .field = f.label :email %br/ - = f.email_field :email, autofocus: true + = f.email_field :email, autofocus: true, autocomplete: "email" - if devise_mapping.confirmable? && resource.pending_reconfirmation? %div Currently waiting confirmation for: #{resource.unconfirmed_email} @@ -13,7 +13,7 @@ = f.label :password %i (leave blank if you don't want to change it) %br/ - = f.password_field :password, autocomplete: "off" + = f.password_field :password, autocomplete: "new-password" - if @minimum_password_length %br/ %em @@ -22,12 +22,12 @@ .field = f.label :password_confirmation %br/ - = f.password_field :password_confirmation, autocomplete: "off" + = f.password_field :password_confirmation, autocomplete: "new-password" .field = f.label :current_password %i (we need your current password to confirm your changes) %br/ - = f.password_field :current_password, autocomplete: "off" + = f.password_field :current_password, autocomplete: "current-password" .actions = f.submit "Update" %h3 Cancel my account diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 41dc5e85..0f9c210a 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,21 +1,21 @@ %h2 Sign up = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .field = f.label :email %br/ - = f.email_field :email, autofocus: true + = f.email_field :email, autofocus: true, autocomplete: "email" .field = f.label :password - if @minimum_password_length %em (#{@minimum_password_length} characters minimum) %br/ - = f.password_field :password, autocomplete: "off" + = f.password_field :password, autocomplete: "new-password" .field = f.label :password_confirmation %br/ - = f.password_field :password_confirmation, autocomplete: "off" + = f.password_field :password_confirmation, autocomplete: "new-password" .actions = f.submit "Sign up" = render "devise/shared/links" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 14b94b0b..71ce0242 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,20 +1,17 @@ -%h2= t '.title' - -%fieldset - = form_for resource, as: resource_name, - url: session_path(resource_name) do |f| - .field.login - = f.label :login - %br/ - = f.text_field :login, autofocus: true - .field.password - = f.label :password - %br/ - = f.password_field :password, autocomplete: 'off' - - if devise_mapping.rememberable? - .field - = f.check_box :remember_me - = f.label :remember_me - .actions= f.submit t('.sign_in') - -= render 'devise/shared/links' +%h2 Log in += form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| + .field + = f.label :email + %br/ + = f.email_field :email, autofocus: true, autocomplete: "email" + .field + = f.label :password + %br/ + = f.password_field :password, autocomplete: "current-password" + - if devise_mapping.rememberable? + .field + = f.check_box :remember_me + = f.label :remember_me + .actions + = f.submit "Log in" += render "devise/shared/links" diff --git a/app/views/devise/shared/_error_messages.html.haml b/app/views/devise/shared/_error_messages.html.haml new file mode 100644 index 00000000..a921fd61 --- /dev/null +++ b/app/views/devise/shared/_error_messages.html.haml @@ -0,0 +1,9 @@ +- if resource.errors.any? + #error_explanation + %h2 + = I18n.t("errors.messages.not_saved", | + count: resource.errors.count, | + resource: resource.class.model_name.human.downcase) | + %ul + - resource.errors.full_messages.each do |message| + %li= message diff --git a/app/views/devise/shared/_links.haml b/app/views/devise/shared/_links.haml deleted file mode 100644 index f763fdcf..00000000 --- a/app/views/devise/shared/_links.haml +++ /dev/null @@ -1,19 +0,0 @@ -- if controller_name != 'sessions' - = link_to "Sign in", new_session_path(resource_name) - %br/ -- if devise_mapping.registerable? && controller_name != 'registrations' - = link_to "Sign up", new_registration_path(resource_name) - %br/ -- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' - = link_to "Forgot your password?", new_password_path(resource_name) - %br/ -- if devise_mapping.confirmable? && controller_name != 'confirmations' - = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) - %br/ -- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) - %br/ -- if devise_mapping.omniauthable? - - resource_class.omniauth_providers.each do |provider| - = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) - %br/ diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index 8df87885..bd4ace46 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -1,10 +1,10 @@ %h2 Resend unlock instructions = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .field = f.label :email %br/ - = f.email_field :email, autofocus: true + = f.email_field :email, autofocus: true, autocomplete: "email" .actions = f.submit "Resend unlock instructions" = render "devise/shared/links"