Skip to content

Commit

Permalink
#161 hotfix authentication admin
Browse files Browse the repository at this point in the history
  • Loading branch information
fdhhhdjd committed Mar 21, 2023
1 parent 299b3f4 commit 79af666
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ const adminController = {
sameSite: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
secure: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
domain:
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ?
req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT
? req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
: CONSTANTS.HEADER_DOMAIN,
maxAge: CONSTANTS._1_MONTH,
});
Expand Down Expand Up @@ -263,8 +263,8 @@ const adminController = {
sameSite: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
secure: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
domain:
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ?
req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT
? req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
: CONSTANTS.HEADER_DOMAIN,
maxAge: CONSTANTS._1_MONTH,
});
Expand Down Expand Up @@ -434,12 +434,12 @@ const adminController = {
class: student.class,
email: student.email,
gender:
student.gender.toLowerCase() === CONSTANTS.GENDER_MALE_STRING ?
CONSTANTS.GENDER_MALE
student.gender.toLowerCase() === CONSTANTS.GENDER_MALE_STRING
? CONSTANTS.GENDER_MALE
: CONSTANTS.GENDER_FEMALE,
avatar_uri:
student.gender.toLowerCase() === CONSTANTS.GENDER_MALE_STRING ?
CONSTANTS.GENDER_IMAGE_MALE
student.gender.toLowerCase() === CONSTANTS.GENDER_MALE_STRING
? CONSTANTS.GENDER_IMAGE_MALE
: CONSTANTS.GENDER_IMAGE_FEMALE,
});
}
Expand Down Expand Up @@ -597,9 +597,7 @@ const adminController = {
const { id } = req.auth_user;

// Input body
const {
name, avatar_uri, public_id_avatar, address, dob, gender,
} = req.body.input.admin_update_profile_input;
const { name, avatar_uri, public_id_avatar, address, dob, gender } = req.body.input.admin_update_profile_input;

// Check id admin
if (!id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ const userController = {
sameSite: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
secure: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
domain:
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ?
req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT
? req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
: CONSTANTS.HEADER_DOMAIN,
maxAge: CONSTANTS._1_MONTH,
});
Expand Down Expand Up @@ -420,8 +420,8 @@ const userController = {
sameSite: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
secure: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ? true : false,
domain:
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT ?
req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_PRODUCT
? req.headers[CONSTANTS.HEADER_HEADER_FORWARDED_HOST]?.split(':')[0]
: CONSTANTS.HEADER_DOMAIN,
maxAge: CONSTANTS._1_MONTH,
});
Expand Down Expand Up @@ -1477,9 +1477,7 @@ const userController = {
const { id } = req.auth_user;

// Input body
const {
name, avatar_uri, public_id_avatar, address, dob, gender,
} = req.body.input.user_update_profile_input;
const { name, avatar_uri, public_id_avatar, address, dob, gender } = req.body.input.user_update_profile_input;

// Check user_id
if (!id) {
Expand Down

0 comments on commit 79af666

Please sign in to comment.