forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes zammad#4410 - Automatic third-party account linking notification.
- Loading branch information
Showing
8 changed files
with
198 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#{config.product_name} account linked with a third-party application | ||
|
||
<div>Hi #{user.firstname},</div> | ||
<br> | ||
<div>It looks like you linked your account <b>with a third-party application</b> "#{provider}".</div> | ||
<br> | ||
<div>If this wasn't you, please remove the linked account from your profile and change your third-party application password. Somebody might have gained unauthorized access to your account on the third-party service.</div> | ||
<br> | ||
<div>Your #{config.product_name} Team</div> |
35 changes: 35 additions & 0 deletions
35
db/migrate/20221209095600_issue_4410_account_linking_notification.rb
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 @@ | ||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
class Issue4410AccountLinkingNotification < ActiveRecord::Migration[6.1] | ||
def change | ||
# return if it's a new setup | ||
return if !Setting.exists?(name: 'system_init_done') | ||
|
||
Setting.create_if_not_exists( | ||
title: 'Automatic account linking notification', | ||
name: 'auth_third_party_linking_notification', | ||
area: 'Security::ThirdPartyAuthentication', | ||
description: 'Enables sending of an email notification to a user when they link their account with a third-party application.', | ||
options: { | ||
form: [ | ||
{ | ||
display: '', | ||
null: true, | ||
name: 'auth_third_party_linking_notification', | ||
tag: 'boolean', | ||
options: { | ||
true => 'yes', | ||
false => 'no', | ||
}, | ||
}, | ||
], | ||
}, | ||
preferences: { | ||
permission: ['admin.security'], | ||
prio: 20, | ||
}, | ||
state: false, | ||
frontend: 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
15 changes: 15 additions & 0 deletions
15
spec/db/migrate/issue_4410_account_linking_notification_spec.rb
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,15 @@ | ||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Issue4410AccountLinkingNotification, type: :db_migration do | ||
before do | ||
Setting.find_by(name: 'auth_third_party_linking_notification').destroy! | ||
|
||
migrate | ||
end | ||
|
||
it 'does create auth_third_party_linking_notification setting' do | ||
expect(Setting.exists?(name: 'auth_third_party_linking_notification')).to be(true) | ||
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