Fixes #3627 - Outdated urls on security page (third-party logins).
This commit is contained in:
parent
8b83bd4c1c
commit
1723d57cdd
4 changed files with 49 additions and 3 deletions
|
@ -29,7 +29,7 @@ class OmniauthOffice365Setting < ActiveRecord::Migration[4.2]
|
||||||
controller: 'SettingsAreaSwitch',
|
controller: 'SettingsAreaSwitch',
|
||||||
sub: ['auth_microsoft_office365_credentials'],
|
sub: ['auth_microsoft_office365_credentials'],
|
||||||
title_i18n: ['Office 365'],
|
title_i18n: ['Office 365'],
|
||||||
description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://apps.dev.microsoft.com'],
|
description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://portal.azure.com'],
|
||||||
permission: ['admin.security'],
|
permission: ['admin.security'],
|
||||||
},
|
},
|
||||||
state: false,
|
state: false,
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
class Issue3627OutdatedUrlsSecurityPage < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
return if !Setting.exists?(name: 'system_init_done')
|
||||||
|
|
||||||
|
setting = Setting.find_by name: 'auth_google_oauth2'
|
||||||
|
setting.preferences[:description_i18n][2] = 'https://console.cloud.google.com/apis/credentials'
|
||||||
|
setting.save!
|
||||||
|
|
||||||
|
setting = Setting.find_by name: 'auth_microsoft_office365'
|
||||||
|
setting.preferences[:description_i18n][2] = 'https://portal.azure.com'
|
||||||
|
setting.save!
|
||||||
|
end
|
||||||
|
end
|
|
@ -1315,7 +1315,7 @@ Setting.create_if_not_exists(
|
||||||
controller: 'SettingsAreaSwitch',
|
controller: 'SettingsAreaSwitch',
|
||||||
sub: ['auth_google_oauth2_credentials'],
|
sub: ['auth_google_oauth2_credentials'],
|
||||||
title_i18n: ['Google'],
|
title_i18n: ['Google'],
|
||||||
description_i18n: ['Google', 'Google API Console Site', 'https://console.developers.google.com/apis/credentials'],
|
description_i18n: ['Google', 'Google API Console Site', 'https://console.cloud.google.com/apis/credentials'],
|
||||||
permission: ['admin.security'],
|
permission: ['admin.security'],
|
||||||
},
|
},
|
||||||
state: false,
|
state: false,
|
||||||
|
@ -1550,7 +1550,7 @@ Setting.create_if_not_exists(
|
||||||
controller: 'SettingsAreaSwitch',
|
controller: 'SettingsAreaSwitch',
|
||||||
sub: ['auth_microsoft_office365_credentials'],
|
sub: ['auth_microsoft_office365_credentials'],
|
||||||
title_i18n: ['Office 365'],
|
title_i18n: ['Office 365'],
|
||||||
description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://apps.dev.microsoft.com'],
|
description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://portal.azure.com'],
|
||||||
permission: ['admin.security'],
|
permission: ['admin.security'],
|
||||||
},
|
},
|
||||||
state: false,
|
state: false,
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Issue3627OutdatedUrlsSecurityPage, type: :db_migration do
|
||||||
|
context 'when having outadted url for google oauth2' do
|
||||||
|
before do
|
||||||
|
setting.preferences[:description_i18n][2] = 'https://console.developers.google.com/apis/credentials'
|
||||||
|
setting.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:setting) { Setting.find_by(name: 'auth_google_oauth2') }
|
||||||
|
|
||||||
|
it 'change url in preference description placeholder' do
|
||||||
|
expect { migrate }.to change { setting.reload.preferences[:description_i18n][2] }.to('https://console.cloud.google.com/apis/credentials')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when having outadted url for microsoft office365' do
|
||||||
|
before do
|
||||||
|
setting.preferences[:description_i18n][2] = 'https://apps.dev.microsoft.com'
|
||||||
|
setting.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:setting) { Setting.find_by(name: 'auth_microsoft_office365') }
|
||||||
|
|
||||||
|
it 'change url in preference description placeholder' do
|
||||||
|
expect { migrate }.to change { setting.reload.preferences[:description_i18n][2] }.to('https://portal.azure.com')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue