Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3523659
D5368.id17632.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D5368.id17632.diff
View Options
diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js
--- a/keyserver/src/responders/user-responders.js
+++ b/keyserver/src/responders/user-responders.js
@@ -4,6 +4,7 @@
import t from 'tcomb';
import bcrypt from 'twin-bcrypt';
+import { hasMinCodeVersion } from 'lib/shared/version-utils';
import type {
ResetPasswordRequest,
LogOutResponse,
@@ -227,7 +228,11 @@
}
const userRow = userResult[0];
if (!userRow.hash || !bcrypt.compareSync(request.password, userRow.hash)) {
- throw new ServerError('invalid_credentials');
+ if (hasMinCodeVersion(viewer.platformDetails, 99999)) {
+ throw new ServerError('invalid_parameters');
+ } else {
+ throw new ServerError('invalid_credentials');
+ }
}
const id = userRow.id.toString();
diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-panel.react.js
@@ -237,16 +237,6 @@
);
};
- onUsernameAlertAcknowledged: () => void = () => {
- this.props.setActiveAlert(false);
- this.props.logInState.setState(
- {
- usernameInputText: '',
- },
- this.focusUsernameInput,
- );
- };
-
async logInAction(extraInfo: LogInExtraInfo): Promise<LogInResult> {
try {
const result = await this.props.logIn({
@@ -262,18 +252,11 @@
});
return result;
} catch (e) {
- if (e.message === 'invalid_parameters') {
- Alert.alert(
- 'Invalid username',
- 'User doesn’t exist',
- [{ text: 'OK', onPress: this.onUsernameAlertAcknowledged }],
- { cancelable: false },
- );
- } else if (e.message === 'invalid_credentials') {
+ if (e.message === 'invalid_credentials') {
Alert.alert(
- 'Incorrect password',
- 'The password you entered is incorrect',
- [{ text: 'OK', onPress: this.onPasswordAlertAcknowledged }],
+ 'Incorrect username or password',
+ "Either that user doesn't exist, or the password is incorrect",
+ [{ text: 'OK', onPress: this.onUnsuccessfulLoginAlertAckowledged }],
{ cancelable: false },
);
} else if (e.message === 'client_version_unsupported') {
@@ -300,6 +283,27 @@
}
}
+ onUnsuccessfulLoginAlertAckowledged: () => void = () => {
+ this.props.setActiveAlert(false);
+ this.props.logInState.setState(
+ {
+ usernameInputText: '',
+ passwordInputText: '',
+ },
+ this.focusUsernameInput,
+ );
+ };
+
+ onUsernameAlertAcknowledged: () => void = () => {
+ this.props.setActiveAlert(false);
+ this.props.logInState.setState(
+ {
+ usernameInputText: '',
+ },
+ this.focusUsernameInput,
+ );
+ };
+
onPasswordAlertAcknowledged: () => void = () => {
this.props.setActiveAlert(false);
this.props.logInState.setState(
diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js
--- a/web/account/log-in-form.react.js
+++ b/web/account/log-in-form.react.js
@@ -40,7 +40,6 @@
const [errorMessage, setErrorMessage] = React.useState<string>('');
const usernameInputRef = React.useRef();
- const passwordInputRef = React.useRef();
React.useEffect(() => {
usernameInputRef.current?.focus();
@@ -72,20 +71,14 @@
modalContext.popModal();
return result;
} catch (e) {
- if (e.message === 'invalid_parameters') {
- setUsername('');
- setErrorMessage(`user doesn't exist`);
- usernameInputRef.current?.focus();
- } else if (e.message === 'invalid_credentials') {
- setPassword('');
- setErrorMessage('wrong password');
- passwordInputRef.current?.focus();
+ setUsername('');
+ setPassword('');
+ if (e.message === 'invalid_credentials') {
+ setErrorMessage('incorrect username or password');
} else {
- setUsername('');
- setPassword('');
setErrorMessage('unknown error');
- usernameInputRef.current?.focus();
}
+ usernameInputRef.current?.focus();
throw e;
}
},
@@ -151,7 +144,6 @@
placeholder="Password"
value={password}
onChange={onPasswordChange}
- ref={passwordInputRef}
disabled={inputDisabled}
/>
</div>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 9:59 AM (17 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2698523
Default Alt Text
D5368.id17632.diff (4 KB)
Attached To
Mode
D5368: [web][native][keyserver] Changing login screen so it displays identical error on wrong username and/or password.
Attached
Detach File
Event Timeline
Log In to Comment