Skip to content

Commit

Permalink
Add comments about changing usernames and what must be done in all th…
Browse files Browse the repository at this point in the history
…e name lists.
  • Loading branch information
Misterblue committed Jun 15, 2021
1 parent 1e353bf commit 82f3b18
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Entities/AccountFields.ts
Expand Up @@ -68,7 +68,7 @@ export const accountFields: { [key: string]: FieldDefn } = {
set_permissions: [ Perm.OWNER, Perm.ADMIN ],
validate: async (pField: FieldDefn, pEntity: Entity, pVal: any): Promise<ValidateResponse> => {
let validity: ValidateResponse;
if (typeof(pVal) === 'string') {
if (typeof(pVal) === 'string' && pVal.length > 0) {
if (pVal.length <= Config['metaverse-server']['max-name-length']) {
if (/^[A-Za-z][A-Za-z0-9+\-_\.]*$/.test(pVal)) {
// Make sure no other account has this username
Expand All @@ -93,7 +93,14 @@ export const accountFields: { [key: string]: FieldDefn } = {
};
return validity;
},
setter: simpleSetter,
// Changing the username requires searching the database and changing the name
// in friend, connection, and manager lists.
setter: async (pField: FieldDefn, pEntity: Entity, pVal: any): Promise<any> => {
// await Accounts.updateUsername((pEntity as AccountEntity).username, pVal as string);
// await Domains.updateUsername((pEntity as AccountEntity).username, pVal as string);
// await Places.updateUsername((pEntity as AccountEntity).username, pVal as string);
return simpleSetter(pField, pEntity, pVal);
},
getter: simpleGetter
},
'email': {
Expand Down

0 comments on commit 82f3b18

Please sign in to comment.