Allow same email address with different SSO providers
This commit is contained in:
parent
381ee35204
commit
63634f00df
3 changed files with 14 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ Devise.setup do |config|
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
# note that it will be overwritten if you use your own mailer class
|
# note that it will be overwritten if you use your own mailer class
|
||||||
# with default "from" parameter.
|
# with default "from" parameter.
|
||||||
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
config.mailer_sender = 'webmaster@screenshots.debian.net'
|
||||||
|
|
||||||
# Configure the class responsible to send e-mails.
|
# Configure the class responsible to send e-mails.
|
||||||
# config.mailer = 'Devise::Mailer'
|
# config.mailer = 'Devise::Mailer'
|
||||||
|
|
@ -35,6 +35,7 @@ Devise.setup do |config|
|
||||||
# You can also supply a hash where the value is a boolean determining whether
|
# You can also supply a hash where the value is a boolean determining whether
|
||||||
# or not authentication should be aborted when the value is not present.
|
# or not authentication should be aborted when the value is not present.
|
||||||
# config.authentication_keys = [:email]
|
# config.authentication_keys = [:email]
|
||||||
|
config.authentication_keys = [:email, :provider]
|
||||||
|
|
||||||
# Configure parameters from the request object used for authentication. Each entry
|
# Configure parameters from the request object used for authentication. Each entry
|
||||||
# given should be a request method and it will automatically be passed to the
|
# given should be a request method and it will automatically be passed to the
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# A user's email address may not be unique if they use different
|
||||||
|
# single-sign-on providers with the same email address.
|
||||||
|
# But the combination of the email address and the (SSO)
|
||||||
|
# provider should be unique.
|
||||||
|
class ChangeUsersUniqueIndexToUidProvider < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
remove_index 'users', 'email'
|
||||||
|
add_index 'users', ["email", "provider"], :unique => true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20170405204143) do
|
ActiveRecord::Schema.define(version: 20170406155141) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
@ -78,7 +78,7 @@ ActiveRecord::Schema.define(version: 20170405204143) do
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
t.string "provider"
|
t.string "provider"
|
||||||
t.string "uid"
|
t.string "uid"
|
||||||
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
|
t.index ["email", "provider"], name: "index_users_on_email_and_provider", unique: true, using: :btree
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key "screenshots", "packages", name: "screenshots_package_id_fkey"
|
add_foreign_key "screenshots", "packages", name: "screenshots_package_id_fkey"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue