Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit d1c4782

Browse files
committed
feat(api): support uppercase names
1 parent 809e9be commit d1c4782

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
exports.up = function (pgm) {
2+
pgm.createExtension('citext', { ifNotExists: true })
3+
pgm.alterColumn('users', 'name', { type: 'citext' })
4+
}
5+
6+
exports.down = function (pgm) {
7+
pgm.alterColumn('users', 'name', { type: 'string' })
8+
pgm.dropExtension('citext', { ifExists: true })
9+
}

server/api/auth/register.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export default {
8181

8282
const conflictRes = await getUserByNameOrEmail({ name, email })
8383
if (conflictRes) {
84-
if (conflictRes.name === name) {
85-
return responses.badKnownName
84+
if (conflictRes.email === email) {
85+
return responses.badKnownEmail
8686
}
87-
return responses.badKnownEmail
87+
return responses.badKnownName
8888
}
8989

9090
const verifyUuid = uuidv4()

server/util/normalize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function normalizeEmail (email: string): string {
66
}
77

88
export function normalizeName (name: string): string {
9-
return name.trim().toLowerCase()
9+
return name.trim()
1010
}
1111

1212
export function normalizeDownload (name: string): string {

0 commit comments

Comments
 (0)