mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
add auth.local.passwordHashMethod field
This commit is contained in:
@@ -125,6 +125,7 @@ api.registerLocal = {
|
|||||||
email,
|
email,
|
||||||
salt,
|
salt,
|
||||||
hashed_password, // eslint-disable-line camelcase
|
hashed_password, // eslint-disable-line camelcase
|
||||||
|
passwordHashMethod: 'sha1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
preferences: {
|
preferences: {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import schema from './schema';
|
|||||||
schema.plugin(baseModel, {
|
schema.plugin(baseModel, {
|
||||||
// noSet is not used as updating uses a whitelist and creating only accepts specific params (password, email, username, ...)
|
// noSet is not used as updating uses a whitelist and creating only accepts specific params (password, email, username, ...)
|
||||||
noSet: [],
|
noSet: [],
|
||||||
private: ['auth.local.hashed_password', 'auth.local.salt', '_cronSignature', '_ABtest', '_ABtests'],
|
private: ['auth.local.hashed_password', 'auth.local.passwordHashMethod', 'auth.local.salt', '_cronSignature', '_ABtest', '_ABtests'],
|
||||||
toJSONTransform: function userToJSON (plainObj, originalDoc) {
|
toJSONTransform: function userToJSON (plainObj, originalDoc) {
|
||||||
plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs
|
plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs
|
||||||
delete plainObj.filters;
|
delete plainObj.filters;
|
||||||
|
|||||||
@@ -54,7 +54,12 @@ let schema = new Schema({
|
|||||||
// Store a lowercase version of username to check for duplicates
|
// Store a lowercase version of username to check for duplicates
|
||||||
lowerCaseUsername: String,
|
lowerCaseUsername: String,
|
||||||
hashed_password: String, // eslint-disable-line camelcase
|
hashed_password: String, // eslint-disable-line camelcase
|
||||||
salt: String,
|
// Legacy password are hashed with SHA1, new ones with bcrypt
|
||||||
|
passwordHashMethod: {
|
||||||
|
type: String,
|
||||||
|
enum: ['bcrypt', 'sha1'],
|
||||||
|
},
|
||||||
|
salt: String, // Salt for SHA1 encrypted passwords, not stored for bcrypt
|
||||||
},
|
},
|
||||||
timestamps: {
|
timestamps: {
|
||||||
created: {type: Date, default: Date.now},
|
created: {type: Date, default: Date.now},
|
||||||
|
|||||||
Reference in New Issue
Block a user