GWM : removed password scope
This commit is contained in:
parent
510fc030ec
commit
7613a5f9b7
@ -65,30 +65,24 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
timestamps: false,
|
timestamps: false,
|
||||||
tableName: "establishment_users",
|
tableName: "establishment_users",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
// 1. EXCLUDE sensitive fields from all queries
|
// // 1. EXCLUDE sensitive fields from all queries
|
||||||
defaultScope: {
|
// defaultScope: {
|
||||||
attributes: { exclude: ["password", "reset_otp", "reset_otp_expires_at"] },
|
// attributes: { exclude: ["password", "reset_otp", "reset_otp_expires_at"] },
|
||||||
},
|
// },
|
||||||
|
|
||||||
// 2. Ensure manual selections still hide sensitive fields
|
// // -------------------------------------------------------------
|
||||||
scopes: {
|
// // 2. Special scope for login or OTP flows
|
||||||
withSensitive: {
|
// // Use: User.scope("withSensitive").findOne(...)
|
||||||
attributes: { include: ["password", "reset_otp", "reset_otp_expires_at"] },
|
// // -------------------------------------------------------------
|
||||||
},
|
// scopes: {
|
||||||
},
|
// withSensitive: {
|
||||||
|
// attributes: {
|
||||||
// 3. Remove sensitive fields when converting to JSON
|
// include: ["password", "reset_otp", "reset_otp_expires_at"],
|
||||||
instanceMethods: {
|
// },
|
||||||
toJSON() {
|
// },
|
||||||
const values = { ...this.get() };
|
// },
|
||||||
delete values.password;
|
// }
|
||||||
delete values.reset_otp;
|
|
||||||
delete values.reset_otp_expires_at;
|
|
||||||
return values;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
EstablishmentUser.associate = (models) => {
|
EstablishmentUser.associate = (models) => {
|
||||||
|
|||||||
@ -35,30 +35,24 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
// 1. EXCLUDE sensitive fields from all queries
|
// // 1. EXCLUDE sensitive fields from all queries
|
||||||
defaultScope: {
|
// defaultScope: {
|
||||||
attributes: { exclude: ["password", "reset_otp", "reset_otp_expires_at"] },
|
// attributes: { exclude: ["password", "reset_otp", "reset_otp_expires_at"] },
|
||||||
},
|
// },
|
||||||
|
|
||||||
// 2. Ensure manual selections still hide sensitive fields
|
// // -------------------------------------------------------------
|
||||||
scopes: {
|
// // 2. Special scope for login or OTP flows
|
||||||
withSensitive: {
|
// // Use: User.scope("withSensitive").findOne(...)
|
||||||
attributes: { include: ["password", "reset_otp", "reset_otp_expires_at"] },
|
// // -------------------------------------------------------------
|
||||||
},
|
// scopes: {
|
||||||
},
|
// withSensitive: {
|
||||||
|
// attributes: {
|
||||||
// 3. Remove sensitive fields when converting to JSON
|
// include: ["password", "reset_otp", "reset_otp_expires_at"],
|
||||||
instanceMethods: {
|
// },
|
||||||
toJSON() {
|
// },
|
||||||
const values = { ...this.get() };
|
// },
|
||||||
delete values.password;
|
// }
|
||||||
delete values.reset_otp;
|
|
||||||
delete values.reset_otp_expires_at;
|
|
||||||
return values;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return User;
|
return User;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user