Skip to content

Commit

Permalink
Allow connecting to a previous server if credentials are not in the k…
Browse files Browse the repository at this point in the history
…eychain (#7661) (#7662)
  • Loading branch information
mattermost-build authored Nov 14, 2023
1 parent 148f9dd commit bcbbc34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/screens/server/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import AppVersion from '@components/app_version';
import {Screens, Launch} from '@constants';
import useNavButtonPressed from '@hooks/navigation_button_pressed';
import {t} from '@i18n';
import {getServerCredentials} from '@init/credentials';
import PushNotifications from '@init/push_notifications';
import NetworkManager from '@managers/network_manager';
import {getServerByDisplayName, getServerByIdentifier} from '@queries/app/servers';
Expand Down Expand Up @@ -244,7 +245,8 @@ const Server = ({
}

const server = await getServerByDisplayName(displayName);
if (server && server.lastActiveAt > 0) {
const credentials = await getServerCredentials(serverUrl);
if (server && server.lastActiveAt > 0 && credentials?.token) {
setButtonDisabled(true);
setDisplayNameError(formatMessage({
id: 'mobile.server_name.exists',
Expand Down Expand Up @@ -330,9 +332,10 @@ const Server = ({
}

const server = await getServerByIdentifier(data.config.DiagnosticId);
const credentials = await getServerCredentials(serverUrl);
setConnecting(false);

if (server && server.lastActiveAt > 0) {
if (server && server.lastActiveAt > 0 && credentials?.token) {
setButtonDisabled(true);
setUrlError(formatMessage({
id: 'mobile.server_identifier.exists',
Expand Down

0 comments on commit bcbbc34

Please sign in to comment.