debian-mirror-gitlab/debian/patches/bump-devise-to-4-6.patch

135 lines
5.4 KiB
Diff
Raw Normal View History

2019-05-21 20:56:07 +05:30
Description: This patch helps in bumping devise to 4.6.2.
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28438
Author: Utkarsh Gupta <guptautkarsh2102@gmail.com>
---
2019-07-07 11:29:07 +05:30
--- a/Gemfile
+++ b/Gemfile
@@ -35,7 +35,7 @@
2019-05-21 20:56:07 +05:30
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'
2019-07-07 11:29:07 +05:30
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -153,7 +153,7 @@
2019-05-21 20:56:07 +05:30
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)
2019-07-07 11:29:07 +05:30
@@ -986,7 +986,7 @@
2019-05-21 20:56:07 +05:30
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)
2019-07-07 11:29:07 +05:30
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1498,15 +1498,6 @@
2019-05-21 20:56:07 +05:30
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
2019-07-07 11:29:07 +05:30
--- a/app/views/devise/confirmations/new.html.haml
+++ b/app/views/devise/confirmations/new.html.haml
2019-05-21 20:56:07 +05:30
@@ -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.'
2019-07-07 11:29:07 +05:30
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
2019-05-21 20:56:07 +05:30
@@ -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"
2019-07-07 11:29:07 +05:30
--- a/app/views/devise/passwords/new.html.haml
+++ b/app/views/devise/passwords/new.html.haml
2019-05-21 20:56:07 +05:30
@@ -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.'
2019-07-07 11:29:07 +05:30
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/devise/registrations/edit.html.erb
2019-05-21 20:56:07 +05:30
@@ -1,7 +1,7 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= 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 %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
2019-07-07 11:29:07 +05:30
--- a/app/views/devise/shared/_signup_box.html.haml
+++ b/app/views/devise/shared/_signup_box.html.haml
2019-05-21 20:56:07 +05:30
@@ -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.")
2019-07-07 11:29:07 +05:30
--- a/app/views/devise/unlocks/new.html.haml
+++ b/app/views/devise/unlocks/new.html.haml
2019-05-21 20:56:07 +05:30
@@ -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.'
2019-07-07 11:29:07 +05:30
--- a/config/initializers/8_devise.rb
+++ b/config/initializers/8_devise.rb
@@ -100,6 +100,11 @@
2019-05-21 20:56:07 +05:30
# 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