mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Changed logic for importPersistUser option (#9203)
no issue - `importing` and `importPersistUser` are two different concepts
This commit is contained in:
parent
dbd22d7447
commit
d507eab3e8
1 changed files with 7 additions and 7 deletions
|
@ -151,14 +151,14 @@ User = ghostBookshelf.Model.extend({
|
|||
if (self.isNew() || self.hasChanged('password')) {
|
||||
this.set('password', String(this.get('password')));
|
||||
|
||||
if (options.importing) {
|
||||
// CASE: import with `importPersistUser` should always be an bcrypt password already,
|
||||
// and won't re-hash or overwrite it.
|
||||
// In case the password is not bcrypt hashed we fall back to the standard behaviour.
|
||||
if (options.importPersistUser && this.get('password').match(/^\$2[ayb]\$.{56}$/i)) {
|
||||
return;
|
||||
}
|
||||
// CASE: import with `importPersistUser` should always be an bcrypt password already,
|
||||
// and won't re-hash or overwrite it.
|
||||
// In case the password is not bcrypt hashed we fall back to the standard behaviour.
|
||||
if (options.importPersistUser && this.get('password').match(/^\$2[ayb]\$.{56}$/i)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.importing) {
|
||||
// always set password to a random uid when importing
|
||||
this.set('password', utils.uid(50));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue