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,
|
||||
|
||||
/**
|
||||
* The credential that the user has failed to authenticate with.
|
||||
*/
|
||||
_errorCredentials: PropTypes.object,
|
||||
|
||||
/**
|
||||
* Any extra details about the error provided by lib-jitsi-meet.
|
||||
*/
|
||||
|
@ -113,6 +118,7 @@ class LoginDialog extends Component {
|
|||
const {
|
||||
_connecting: connecting,
|
||||
_error: error,
|
||||
_errorCredentials: errorCredentials,
|
||||
_errorDetails: errorDetails,
|
||||
t
|
||||
} = this.props;
|
||||
|
@ -121,7 +127,12 @@ class LoginDialog extends Component {
|
|||
const messageOptions = {};
|
||||
|
||||
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) {
|
||||
messageKey = 'dialog.connectErrorWithMsg';
|
||||
messageOptions.msg = `${error} ${errorDetails}`;
|
||||
|
@ -147,7 +158,7 @@ class LoginDialog extends Component {
|
|||
value = { this.state.password } />
|
||||
<Text style = { styles.loginDialogText }>
|
||||
{
|
||||
error
|
||||
messageKey
|
||||
? t(messageKey, messageOptions)
|
||||
: connecting
|
||||
? t('connection.CONNECTING')
|
||||
|
@ -229,6 +240,7 @@ class LoginDialog extends Component {
|
|||
* _configHosts: Object,
|
||||
* _connecting: boolean,
|
||||
* _error: string,
|
||||
* _errorCredentials: Object,
|
||||
* _errorDetails: string
|
||||
* }}
|
||||
*/
|
||||
|
@ -241,20 +253,24 @@ function _mapStateToProps(state) {
|
|||
const { hosts: configHosts } = state['features/base/config'];
|
||||
const {
|
||||
connecting,
|
||||
credentials,
|
||||
error: connectionError,
|
||||
errorMessage: connectionErrorMessage
|
||||
} = state['features/base/connection'];
|
||||
|
||||
let error;
|
||||
let errorCredentials;
|
||||
let errorDetails;
|
||||
|
||||
if (connectionError) {
|
||||
error = connectionError;
|
||||
errorCredentials = credentials;
|
||||
errorDetails = connectionErrorMessage;
|
||||
} else if (upgradeRoleError) {
|
||||
error
|
||||
= upgradeRoleError.connectionError
|
||||
|| upgradeRoleError.authenticationError;
|
||||
errorCredentials = upgradeRoleError.credentials;
|
||||
errorDetails = upgradeRoleError.message;
|
||||
}
|
||||
|
||||
|
@ -263,6 +279,7 @@ function _mapStateToProps(state) {
|
|||
_configHosts: configHosts,
|
||||
_connecting: Boolean(connecting) || Boolean(upgradeRoleInProgress),
|
||||
_error: error,
|
||||
_errorCredentials: errorCredentials,
|
||||
_errorDetails: errorDetails
|
||||
};
|
||||
}
|
||||
|
|
|
@ -81,14 +81,18 @@ export function connect(id: ?string, password: ?string) {
|
|||
* Rejects external promise when connection fails.
|
||||
*
|
||||
* @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}
|
||||
* @private
|
||||
*/
|
||||
function _onConnectionFailed(err, msg) {
|
||||
function _onConnectionFailed(err, msg, credentials) {
|
||||
unsubscribe();
|
||||
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.
|
||||
*
|
||||
* @param {JitsiConnection} connection - The JitsiConnection which failed.
|
||||
* @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
|
||||
* @returns {{
|
||||
* type: CONNECTION_FAILED,
|
||||
* connection: JitsiConnection,
|
||||
* credentials: Object,
|
||||
* error: string,
|
||||
* message: string
|
||||
* }}
|
||||
|
@ -180,15 +189,19 @@ export function connectionEstablished(connection: Object) {
|
|||
export function connectionFailed(
|
||||
connection: Object,
|
||||
error: string,
|
||||
message: ?string) {
|
||||
message: ?string,
|
||||
credentials: ?Object) {
|
||||
return {
|
||||
type: CONNECTION_FAILED,
|
||||
connection,
|
||||
credentials,
|
||||
error,
|
||||
message
|
||||
};
|
||||
}
|
||||
|
||||
/* eslint-enable max-params */
|
||||
|
||||
/**
|
||||
* Constructs options to be passed to the constructor of {@code JitsiConnection}
|
||||
* based on the redux state.
|
||||
|
|
|
@ -93,8 +93,9 @@ function _connectionEstablished(
|
|||
*/
|
||||
function _connectionFailed(
|
||||
state: Object,
|
||||
{ connection, error, message }: {
|
||||
{ connection, credentials, error, message }: {
|
||||
connection: Object,
|
||||
credentials: ?Object,
|
||||
error: string,
|
||||
message: ?string
|
||||
}) {
|
||||
|
@ -105,6 +106,7 @@ function _connectionFailed(
|
|||
return assign(state, {
|
||||
connecting: undefined,
|
||||
connection: undefined,
|
||||
credentials,
|
||||
error,
|
||||
errorMessage: message
|
||||
});
|
||||
|
@ -125,6 +127,7 @@ function _connectionWillConnect(
|
|||
{ connection }: { connection: Object }) {
|
||||
return assign(state, {
|
||||
connecting: connection,
|
||||
credentials: undefined,
|
||||
error: undefined,
|
||||
errorMessage: undefined
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue