Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Fix validation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed May 13, 2019
1 parent f62f0b1 commit 8a50f01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/rest/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export const register = async (
if (email) await checkIfNewEmail(email);
// Create user
if (user.name) validate(user.name, ValidationTypes.TEXT);
if (user.nickname) validate(user.name, ValidationTypes.TEXT);
if (user.countryCode) validate(user.name, ValidationTypes.COUNTRY_CODE);
if (user.nickname) validate(user.nickname, ValidationTypes.TEXT);
if (user.countryCode)
validate(user.countryCode, ValidationTypes.COUNTRY_CODE);
if (user.password) validate(user.password, ValidationTypes.TEXT);
if (user.gender) validate(user.gender, ValidationTypes.GENDER);
if (user.preferredLanguage)
Expand Down
5 changes: 3 additions & 2 deletions src/rest/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ export const updateUserForUser = async (
locals: Locals
) => {
if (data.name) validate(data.name, ValidationTypes.TEXT);
if (data.nickname) validate(data.name, ValidationTypes.TEXT);
if (data.countryCode) validate(data.name, ValidationTypes.COUNTRY_CODE);
if (data.nickname) validate(data.nickname, ValidationTypes.TEXT);
if (data.countryCode)
validate(data.countryCode, ValidationTypes.COUNTRY_CODE);
if (data.password) validate(data.password, ValidationTypes.TEXT);
if (data.gender) validate(data.gender, ValidationTypes.GENDER);
if (data.preferredLanguage)
Expand Down

0 comments on commit 8a50f01

Please sign in to comment.