From 93c3faf141c1927a390b2e22169cad90a6a628ed Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Mar 2017 20:38:27 +0900 Subject: [PATCH] [API] Fix bug and change limit 50 to 30 --- src/api/endpoints/i/update.js | 4 ++++ src/api/models/user.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/endpoints/i/update.js b/src/api/endpoints/i/update.js index 4b4d1743da..4abb4fcb7b 100644 --- a/src/api/endpoints/i/update.js +++ b/src/api/endpoints/i/update.js @@ -25,6 +25,10 @@ module.exports = async (params, user, _, isSecure) => // Get 'name' parameter const name = params.name; if (name !== undefined && name !== null) { + if (typeof name != 'string') { + return rej('name must be a string'); + } + if (!isValidName(name)) { return rej('invalid name'); } diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 55f8b7faa8..5ab39d7c92 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -16,7 +16,7 @@ export function validatePassword(password: string): boolean { } export function isValidName(name: string): boolean { - return typeof name == 'string' && name.length > 50 && name.trim() != ''; + return typeof name == 'string' && name.length < 30 && name.trim() != ''; } export function isValidBirthday(birthday: string): boolean {