mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
fixing sharing password bug
This commit is contained in:
parent
a2c39653e5
commit
1b2e941fa5
@ -83,7 +83,7 @@ export class SharingMWs {
|
||||
id: updateSharing.id,
|
||||
path: directoryName,
|
||||
sharingKey: '',
|
||||
password: updateSharing.password,
|
||||
password: (updateSharing.password && updateSharing.password !== '') ? updateSharing.password : null,
|
||||
creator: req.session.user,
|
||||
expires: Date.now() + updateSharing.valid,
|
||||
includeSubfolders: updateSharing.includeSubfolders,
|
||||
|
@ -93,9 +93,12 @@ export class AuthenticationMWs {
|
||||
const sharing = await ObjectManagerRepository.getInstance().SharingManager.findOne({
|
||||
sharingKey: req.query.sk || req.params.sharingKey,
|
||||
});
|
||||
|
||||
console.log(sharing);
|
||||
if (!sharing || sharing.expires < Date.now() ||
|
||||
(Config.Client.Sharing.passwordProtected === true
|
||||
&& sharing.password && !PasswordHelper.comparePassword(password, sharing.password))) {
|
||||
&& (sharing.password)
|
||||
&& !PasswordHelper.comparePassword(password, sharing.password))) {
|
||||
return next(new ErrorDTO(ErrorCodes.CREDENTIAL_NOT_FOUND));
|
||||
}
|
||||
|
||||
@ -159,7 +162,9 @@ export class AuthenticationMWs {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Config.Client.Sharing.passwordProtected === true && sharing.password) {
|
||||
console.log(sharing);
|
||||
|
||||
if (Config.Client.Sharing.passwordProtected === true && (sharing.password)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -87,14 +87,14 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
|
||||
if (this.sharing == null) {
|
||||
return;
|
||||
}
|
||||
this.url = 'loading..';
|
||||
this.url = this.i18n('loading..');
|
||||
this.sharing = await this._sharingService.updateSharing(this.currentDir,
|
||||
this.sharing.id, this.input.includeSubfolders, this.input.password, this.calcValidity());
|
||||
this.url = Config.Client.publicUrl + '/share/' + this.sharing.sharingKey;
|
||||
}
|
||||
|
||||
async get() {
|
||||
this.url = 'loading..';
|
||||
this.url = this.i18n('loading..');
|
||||
this.sharing = await this._sharingService.createSharing(this.currentDir, this.input.includeSubfolders, this.calcValidity());
|
||||
this.url = Config.Client.publicUrl + '/share/' + this.sharing.sharingKey;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
||||
"@angular/core": "5.2.10",
|
||||
"@angular/forms": "5.2.10",
|
||||
"@angular/http": "5.2.10",
|
||||
"@angular/language-service": "5.2.10",
|
||||
"@angular/language-service": "^5.2.10",
|
||||
"@angular/platform-browser": "5.2.10",
|
||||
"@angular/platform-browser-dynamic": "5.2.10",
|
||||
"@angular/router": "5.2.10",
|
||||
|
Loading…
Reference in New Issue
Block a user