fix(LoginDialog.native): no 'password incorrect' initially
Do not show the 'Password is incorrect' message when the LoginDialog opens for the first time.
This commit is contained in:
parent
da3e59571e
commit
f8b607e92e
|
@ -66,6 +66,11 @@ class LoginDialog extends Component {
|
||||||
*/
|
*/
|
||||||
_error: PropTypes.string,
|
_error: PropTypes.string,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The credential that the user has failed to authenticate with.
|
||||||
|
*/
|
||||||
|
_errorCredentials: PropTypes.object,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any extra details about the error provided by lib-jitsi-meet.
|
* Any extra details about the error provided by lib-jitsi-meet.
|
||||||
*/
|
*/
|
||||||
|
@ -113,6 +118,7 @@ class LoginDialog extends Component {
|
||||||
const {
|
const {
|
||||||
_connecting: connecting,
|
_connecting: connecting,
|
||||||
_error: error,
|
_error: error,
|
||||||
|
_errorCredentials: errorCredentials,
|
||||||
_errorDetails: errorDetails,
|
_errorDetails: errorDetails,
|
||||||
t
|
t
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -121,7 +127,12 @@ class LoginDialog extends Component {
|
||||||
const messageOptions = {};
|
const messageOptions = {};
|
||||||
|
|
||||||
if (error === JitsiConnectionErrors.PASSWORD_REQUIRED) {
|
if (error === JitsiConnectionErrors.PASSWORD_REQUIRED) {
|
||||||
messageKey = 'dialog.incorrectPassword';
|
// Show the message if there's been a user ID or password provided.
|
||||||
|
messageKey
|
||||||
|
= errorCredentials
|
||||||
|
&& (errorCredentials.jid || errorCredentials.password)
|
||||||
|
? 'dialog.incorrectPassword'
|
||||||
|
: null;
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
messageKey = 'dialog.connectErrorWithMsg';
|
messageKey = 'dialog.connectErrorWithMsg';
|
||||||
messageOptions.msg = `${error} ${errorDetails}`;
|
messageOptions.msg = `${error} ${errorDetails}`;
|
||||||
|
@ -147,7 +158,7 @@ class LoginDialog extends Component {
|
||||||
value = { this.state.password } />
|
value = { this.state.password } />
|
||||||
<Text style = { styles.loginDialogText }>
|
<Text style = { styles.loginDialogText }>
|
||||||
{
|
{
|
||||||
error
|
messageKey
|
||||||
? t(messageKey, messageOptions)
|
? t(messageKey, messageOptions)
|
||||||
: connecting
|
: connecting
|
||||||
? t('connection.CONNECTING')
|
? t('connection.CONNECTING')
|
||||||
|
@ -229,6 +240,7 @@ class LoginDialog extends Component {
|
||||||
* _configHosts: Object,
|
* _configHosts: Object,
|
||||||
* _connecting: boolean,
|
* _connecting: boolean,
|
||||||
* _error: string,
|
* _error: string,
|
||||||
|
* _errorCredentials: Object,
|
||||||
* _errorDetails: string
|
* _errorDetails: string
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
|
@ -241,20 +253,24 @@ function _mapStateToProps(state) {
|
||||||
const { hosts: configHosts } = state['features/base/config'];
|
const { hosts: configHosts } = state['features/base/config'];
|
||||||
const {
|
const {
|
||||||
connecting,
|
connecting,
|
||||||
|
credentials,
|
||||||
error: connectionError,
|
error: connectionError,
|
||||||
errorMessage: connectionErrorMessage
|
errorMessage: connectionErrorMessage
|
||||||
} = state['features/base/connection'];
|
} = state['features/base/connection'];
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
let errorCredentials;
|
||||||
let errorDetails;
|
let errorDetails;
|
||||||
|
|
||||||
if (connectionError) {
|
if (connectionError) {
|
||||||
error = connectionError;
|
error = connectionError;
|
||||||
|
errorCredentials = credentials;
|
||||||
errorDetails = connectionErrorMessage;
|
errorDetails = connectionErrorMessage;
|
||||||
} else if (upgradeRoleError) {
|
} else if (upgradeRoleError) {
|
||||||
error
|
error
|
||||||
= upgradeRoleError.connectionError
|
= upgradeRoleError.connectionError
|
||||||
|| upgradeRoleError.authenticationError;
|
|| upgradeRoleError.authenticationError;
|
||||||
|
errorCredentials = upgradeRoleError.credentials;
|
||||||
errorDetails = upgradeRoleError.message;
|
errorDetails = upgradeRoleError.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +279,7 @@ function _mapStateToProps(state) {
|
||||||
_configHosts: configHosts,
|
_configHosts: configHosts,
|
||||||
_connecting: Boolean(connecting) || Boolean(upgradeRoleInProgress),
|
_connecting: Boolean(connecting) || Boolean(upgradeRoleInProgress),
|
||||||
_error: error,
|
_error: error,
|
||||||
|
_errorCredentials: errorCredentials,
|
||||||
_errorDetails: errorDetails
|
_errorDetails: errorDetails
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,14 +81,18 @@ export function connect(id: ?string, password: ?string) {
|
||||||
* Rejects external promise when connection fails.
|
* Rejects external promise when connection fails.
|
||||||
*
|
*
|
||||||
* @param {JitsiConnectionErrors} err - Connection error.
|
* @param {JitsiConnectionErrors} err - Connection error.
|
||||||
* @param {string} msg - Error message supplied by lib-jitsi-meet.
|
* @param {string} [msg] - Error message supplied by lib-jitsi-meet.
|
||||||
|
* @param {Object} [credentials] - The invalid credentials that were
|
||||||
|
* used to authenticate and the authentication failed.
|
||||||
|
* @param {string} [credentials.jid] - The XMPP user's ID.
|
||||||
|
* @param {string} [credentials.password] - The XMPP user's password.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
function _onConnectionFailed(err, msg) {
|
function _onConnectionFailed(err, msg, credentials) {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
console.error('CONNECTION FAILED:', err, msg);
|
console.error('CONNECTION FAILED:', err, msg);
|
||||||
dispatch(connectionFailed(connection, err, msg));
|
dispatch(connectionFailed(connection, err, msg, credentials));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,16 +167,21 @@ export function connectionEstablished(connection: Object) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable max-params */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an action for when the signaling connection could not be created.
|
* Create an action for when the signaling connection could not be created.
|
||||||
*
|
*
|
||||||
* @param {JitsiConnection} connection - The JitsiConnection which failed.
|
* @param {JitsiConnection} connection - The JitsiConnection which failed.
|
||||||
* @param {string} error - Error.
|
* @param {string} error - Error.
|
||||||
* @param {string} message - Error message.
|
* @param {string} [message] - Error message.
|
||||||
|
* @param {Object} [credentials] - The invalid credentials that failed
|
||||||
|
* the authentication.
|
||||||
* @public
|
* @public
|
||||||
* @returns {{
|
* @returns {{
|
||||||
* type: CONNECTION_FAILED,
|
* type: CONNECTION_FAILED,
|
||||||
* connection: JitsiConnection,
|
* connection: JitsiConnection,
|
||||||
|
* credentials: Object,
|
||||||
* error: string,
|
* error: string,
|
||||||
* message: string
|
* message: string
|
||||||
* }}
|
* }}
|
||||||
|
@ -180,15 +189,19 @@ export function connectionEstablished(connection: Object) {
|
||||||
export function connectionFailed(
|
export function connectionFailed(
|
||||||
connection: Object,
|
connection: Object,
|
||||||
error: string,
|
error: string,
|
||||||
message: ?string) {
|
message: ?string,
|
||||||
|
credentials: ?Object) {
|
||||||
return {
|
return {
|
||||||
type: CONNECTION_FAILED,
|
type: CONNECTION_FAILED,
|
||||||
connection,
|
connection,
|
||||||
|
credentials,
|
||||||
error,
|
error,
|
||||||
message
|
message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-enable max-params */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs options to be passed to the constructor of {@code JitsiConnection}
|
* Constructs options to be passed to the constructor of {@code JitsiConnection}
|
||||||
* based on the redux state.
|
* based on the redux state.
|
||||||
|
|
|
@ -93,8 +93,9 @@ function _connectionEstablished(
|
||||||
*/
|
*/
|
||||||
function _connectionFailed(
|
function _connectionFailed(
|
||||||
state: Object,
|
state: Object,
|
||||||
{ connection, error, message }: {
|
{ connection, credentials, error, message }: {
|
||||||
connection: Object,
|
connection: Object,
|
||||||
|
credentials: ?Object,
|
||||||
error: string,
|
error: string,
|
||||||
message: ?string
|
message: ?string
|
||||||
}) {
|
}) {
|
||||||
|
@ -105,6 +106,7 @@ function _connectionFailed(
|
||||||
return assign(state, {
|
return assign(state, {
|
||||||
connecting: undefined,
|
connecting: undefined,
|
||||||
connection: undefined,
|
connection: undefined,
|
||||||
|
credentials,
|
||||||
error,
|
error,
|
||||||
errorMessage: message
|
errorMessage: message
|
||||||
});
|
});
|
||||||
|
@ -125,6 +127,7 @@ function _connectionWillConnect(
|
||||||
{ connection }: { connection: Object }) {
|
{ connection }: { connection: Object }) {
|
||||||
return assign(state, {
|
return assign(state, {
|
||||||
connecting: connection,
|
connecting: connection,
|
||||||
|
credentials: undefined,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
errorMessage: undefined
|
errorMessage: undefined
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue