Skip to content

Commit

Permalink
FIX: duplicateCheck nickname validation #2
Browse files Browse the repository at this point in the history
  • Loading branch information
khl6235 committed Apr 13, 2022
1 parent e82a305 commit 852654e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vinyla/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ module.exports = {
if(!nickname){
return await res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, resMessage.NULL_VALUE));
}
const regex = /^[γ„±-γ…Ž|κ°€-힣|a-z|A-Z|0-9|]+$/;
if(nickname.length < 2 || nickname.length > 20 || !regex.test(nickname)){
return await res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, resMessage.INVALID_NICKNAME));
}
const isDuplicate = await UserModel.duplicateCheck(nickname);
if(!isDuplicate){
return await res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, resMessage.ALREADY_NICKNAME));
Expand Down
1 change: 1 addition & 0 deletions vinyla/modules/responseMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
DELETE_USER: "νšŒμ› νƒˆν‡΄ 성곡",

ALREADY_NICKNAME: "μ‚¬μš© 쀑인 λ‹‰λ„€μž„μž…λ‹ˆλ‹€.",
INVALID_NICKNAME: "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ ν˜•μ‹μž…λ‹ˆλ‹€.",
NO_DUPLICATE: "μ‚¬μš© κ°€λŠ₯ν•œ λ‹‰λ„€μž„μž…λ‹ˆλ‹€.",

LOGIN_SUCCESS: "둜그인 성곡",
Expand Down

0 comments on commit 852654e

Please sign in to comment.