Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3285994
D11201.id37725.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11201.id37725.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11201: [keyserver][native] treat valid eth address as invalid username in non-siwe registration
Attached
Detach File
Event Timeline
Log In to Comment