Page MenuHomePhabricator

D11201.id37725.diff
No OneTemporary

D11201.id37725.diff

diff --git a/keyserver/src/creators/account-creator.js b/keyserver/src/creators/account-creator.js
--- a/keyserver/src/creators/account-creator.js
+++ b/keyserver/src/creators/account-creator.js
@@ -72,7 +72,10 @@
if (request.password.trim() === '') {
throw new ServerError('empty_password');
}
- if (request.username.search(validUsernameRegex) === -1) {
+ if (
+ request.username.search(validUsernameRegex) === -1 ||
+ isValidEthereumAddress(request.username.toLowerCase())
+ ) {
throw new ServerError('invalid_username');
}
@@ -87,10 +90,7 @@
}
const [existingUser, admin] = await Promise.all(promises);
- if (
- reservedUsernamesSet.has(request.username.toLowerCase()) ||
- isValidEthereumAddress(request.username.toLowerCase())
- ) {
+ if (reservedUsernamesSet.has(request.username.toLowerCase())) {
throw new ServerError('username_reserved');
}
if (existingUser) {
diff --git a/native/account/registration/username-selection.react.js b/native/account/registration/username-selection.react.js
--- a/native/account/registration/username-selection.react.js
+++ b/native/account/registration/username-selection.react.js
@@ -12,6 +12,7 @@
import { validUsernameRegex } from 'lib/shared/account-utils.js';
import { useLegacyAshoatKeyserverCall } from 'lib/utils/action-utils.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
+import { isValidEthereumAddress } from 'lib/utils/siwe-utils.js';
import RegistrationButtonContainer from './registration-button-container.react.js';
import RegistrationButton from './registration-button.react.js';
@@ -53,7 +54,9 @@
const [username, setUsername] = React.useState(
cachedSelections.username ?? '',
);
- const validUsername = username.search(validUsernameRegex) > -1;
+ const validUsername =
+ username.search(validUsernameRegex) > -1 &&
+ !isValidEthereumAddress(username.toLowerCase());
const [usernameError, setUsernameError] = React.useState<?UsernameError>();
const checkUsernameValidity = React.useCallback(() => {

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 1:07 PM (21 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2525233
Default Alt Text
D11201.id37725.diff (2 KB)

Event Timeline