diff --git a/app/lib/methods/getSettings.js b/app/lib/methods/getSettings.js index 35cd20ade..0e13d378b 100644 --- a/app/lib/methods/getSettings.js +++ b/app/lib/methods/getSettings.js @@ -13,6 +13,22 @@ import fetch from '../../utils/fetch'; const serverInfoKeys = ['Site_Name', 'UI_Use_Real_Name', 'FileUpload_MediaTypeWhiteList', 'FileUpload_MaxFileSize']; +// these settings are used only on onboarding process +const loginSettings = [ + 'API_Gitlab_URL', + 'CAS_enabled', + 'CAS_login_url', + 'Accounts_EmailVerification', + 'Accounts_ManuallyApproveNewUsers', + 'Accounts_ShowFormLogin', + 'Site_Url', + 'Accounts_RegistrationForm', + 'Accounts_RegistrationForm_LinkReplacementText', + 'Accounts_EmailOrUsernamePlaceholder', + 'Accounts_PasswordPlaceholder', + 'Accounts_PasswordReset' +]; + const serverInfoUpdate = async(serverInfo, iconSetting) => { const serversDB = database.servers; const serverId = reduxStore.getState().server.server; @@ -54,7 +70,7 @@ const serverInfoUpdate = async(serverInfo, iconSetting) => { export async function getLoginSettings({ server }) { try { - const settingsParams = JSON.stringify(['Accounts_ShowFormLogin', 'Accounts_RegistrationForm']); + const settingsParams = JSON.stringify(loginSettings); const result = await fetch(`${ server }/api/v1/settings.public?query={"_id":{"$in":${ settingsParams }}}`).then(response => response.json()); if (result.success && result.settings.length) { @@ -84,7 +100,7 @@ export async function setSettings() { export default async function() { try { const db = database.active; - const settingsParams = JSON.stringify(Object.keys(settings)); + const settingsParams = JSON.stringify(Object.keys(settings).filter(key => !loginSettings.includes(key))); // RC 0.60.0 const result = await fetch(`${ this.sdk.client.host }/api/v1/settings.public?query={"_id":{"$in":${ settingsParams }}}`).then(response => response.json()); diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index ee2cfc7dd..ed26c4541 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -12,8 +12,8 @@ import * as actions from '../actions'; import { serverFailure, selectServerRequest, selectServerSuccess, selectServerFailure } from '../actions/server'; -import { setUser } from '../actions/login'; import { clearSettings } from '../actions/settings'; +import { setUser } from '../actions/login'; import RocketChat from '../lib/rocketchat'; import database from '../lib/database'; import log, { logServerVersion } from '../utils/log'; @@ -98,9 +98,8 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch const basicAuth = yield RNUserDefaults.get(`${ BASIC_AUTH_KEY }-${ server }`); setBasicAuth(basicAuth); - yield put(clearSettings()); - if (user) { + yield put(clearSettings()); yield RocketChat.connect({ server, user, logoutOnError: true }); yield put(setUser(user)); yield put(actions.appStart('inside'));