Description: This patch helps in bumping devise to 4.6.2. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28438 Author: Utkarsh Gupta --- --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ gem 'faraday', '~> 0.12' # Authentication libraries -gem 'devise', '~> 4.4' +gem 'devise', '~> 4.6' gem 'doorkeeper', '~> 4.3' gem 'doorkeeper-openid_connect', '~> 1.5' gem 'omniauth', '~> 1.8' --- a/Gemfile.lock +++ b/Gemfile.lock @@ -156,7 +156,7 @@ descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) device_detector (1.0.0) - devise (4.4.3) + devise (4.6.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 6.0) @@ -1032,7 +1032,7 @@ database_cleaner (~> 1.7.0) deckar01-task_list (= 2.2.0) device_detector - devise (~> 4.4) + devise (~> 4.6) devise-two-factor (~> 3.0.0) diffy (~> 3.1.0) discordrb-webhooks-blackst0ne (~> 3.3) --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1497,15 +1497,6 @@ devise_mailer.__send__(notification, self, *args).deliver_later # rubocop:disable GitlabSecurity/PublicSend end - # This works around a bug in Devise 4.2.0 that erroneously causes a user to - # be considered active in MySQL specs due to a sub-second comparison - # issue. For more details, see: https://gitlab.com/gitlab-org/gitlab-ee/issues/2362#note_29004709 - def confirmation_period_valid? - return false if self.class.allow_unconfirmed_access_for == 0.days - - super - end - def ensure_user_rights_and_limits if external? self.can_create_group = false --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -3,7 +3,7 @@ .login-body = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f| .devise-errors - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .form-group = f.label :email = f.email_field :email, class: "form-control", required: true, title: 'Please provide a valid email address.' --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -3,7 +3,7 @@ .login-body = form_for(resource, as: resource_name, url: password_path(:user), html: { method: :put, class: 'gl-show-field-errors' }) do |f| .devise-errors - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource = f.hidden_field :reset_password_token .form-group = f.label 'New password', for: "user_password" --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -3,7 +3,7 @@ .login-body = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f| .devise-errors - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .form-group = f.label :email = f.email_field :email, class: "form-control", required: true, value: params[:user_email], autofocus: true, title: 'Please provide a valid email address.' --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,7 +1,7 @@

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 %>
<%= f.label :email %>
<%= f.email_field :email %>
--- a/app/views/devise/shared/_signup_box.html.haml +++ b/app/views/devise/shared/_signup_box.html.haml @@ -2,7 +2,7 @@ .login-body = form_for(resource, as: "new_#{resource_name}", url: registration_path(resource_name), html: { class: "new_new_user gl-show-field-errors", "aria-live" => "assertive" }) do |f| .devise-errors - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .name.form-group = f.label :name, 'Full name', class: 'label-bold' = f.text_field :name, class: "form-control top qa-new-user-name js-block-emoji", required: true, title: _("This field is required.") --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -3,7 +3,7 @@ .login-body = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f| .devise-errors - = devise_error_messages! + = render "devise/shared/error_messages", resource: resource .form-group.append-bottom-20 = f.label :email = f.email_field :email, class: 'form-control', autofocus: 'autofocus', autocapitalize: 'off', autocorrect: 'off', title: 'Please provide a valid email address.' --- a/config/initializers/8_devise.rb +++ b/config/initializers/8_devise.rb @@ -100,6 +100,11 @@ # secure: true in order to force SSL only cookies. # config.cookie_options = {} + # When set to false, does not sign a user in automatically after their password is + # changed. Defaults to true, so a user is signed in automatically after a password + # is changed. + config.sign_in_after_change_password = false + # Send a notification email when the user's password is changed config.send_password_change_notification = true