Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3523615
D5368.id17574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D5368.id17574.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({
@@ -264,16 +254,9 @@
} 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') {
- Alert.alert(
- 'Incorrect password',
- 'The password you entered is incorrect',
- [{ text: 'OK', onPress: this.onPasswordAlertAcknowledged }],
+ 'Incorrect username or password',
+ '',
+ [{ 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: '',
+ },
+ this.focusUsernameInput,
+ );
+ };
+
+ onUsernameAlertAcknowledged: () => void = () => {
+ this.props.setActiveAlert(false);
+ this.props.logInState.setState(
+ {
+ usernameInputText: '',
+ passwordInputText: '',
+ },
+ 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();
@@ -70,12 +69,9 @@
} 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();
+ setErrorMessage('incorrect username or password');
+ usernameInputRef.current?.focus();
} else {
setUsername('');
setPassword('');
@@ -149,7 +145,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:48 AM (17 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699506
Default Alt Text
D5368.id17574.diff (3 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