-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow adding and removing OmniAuth account links (#1316)
* Allow adding and removing OmniAuth account links * Allow OmniAuth users to perform changes to their account In order to allow changes, we disable the password requirement for those users. As soon as a password is set for OmniAuth users, the regular workflow requiring the current password is restored. * Prevent deletion of last OmniAuth identity * Add specs for OmniAuth::Strategies (#1318)
- Loading branch information
Showing
28 changed files
with
1,357 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
de: | ||
users: | ||
omni_auth: | ||
failure_deauthorize: 'Das Trennen von Ihrem %{kind}-Account war aufgrund des folgenden Grundes nicht möglich: "%{reason}".' | ||
failure_deauthorize_last_identity: Sie können sich nicht von Ihrem %{kind}-Account trennen, da dies Ihr letzter verbleibender Account ist. Bitte erstellen Sie ein Passwort, um sich in Zukunft anmelden zu können. | ||
failure_deauthorize_not_linked: Sie sind nicht mit einem %{kind}-Account verbunden. | ||
success_deauthorize: Sie haben sich erfolgreich von Ihrem %{kind}-Account getrennt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
en: | ||
users: | ||
omni_auth: | ||
failure_deauthorize: Could not remove authorization from %{kind} because "%{reason}". | ||
failure_deauthorize_last_identity: You cannot deauthorize your %{kind} account because it is your last remaining account. Please create a password to log in in the future. | ||
failure_deauthorize_not_linked: You are not linked to any %{kind} account. | ||
success_deauthorize: Successfully removed authorization from %{kind} account. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,11 @@ omniauth: | |
enable: false | ||
bird: | ||
enable: false | ||
certificate: ~ | ||
private_key: ~ | ||
nbp: | ||
enable: false | ||
certificate: ~ | ||
private_key: ~ | ||
oai_pmh: | ||
admin_mail: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddPasswordSetToUsers < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :users, :password_set, :boolean, default: true, null: false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
module OmniAuth | ||
class NonceStore | ||
MAXIMUM_AGE = 30.minutes | ||
|
||
def self.build_cache_key(nonce) | ||
"omniauth_nonce_#{nonce}" | ||
end | ||
|
||
def self.add(value) | ||
nonce = Devise.friendly_token | ||
cache.write(build_cache_key(nonce), value, expires_in: MAXIMUM_AGE) | ||
nonce | ||
end | ||
|
||
def self.read(nonce) | ||
cache.read(build_cache_key(nonce)) | ||
end | ||
|
||
def self.delete(nonce) | ||
cache.delete(build_cache_key(nonce)) | ||
end | ||
|
||
def self.pop(nonce) | ||
value = read(nonce) | ||
delete(nonce) if value | ||
value | ||
end | ||
|
||
def self.cache | ||
@cache ||= ActiveSupport::Cache.lookup_store(:file_store, '/tmp/cache/omniauth') | ||
end | ||
end | ||
end |
Oops, something went wrong.