diff --git a/backend/middlewares/SharingMWs.ts b/backend/middlewares/SharingMWs.ts index f4df944b..f9d1637a 100644 --- a/backend/middlewares/SharingMWs.ts +++ b/backend/middlewares/SharingMWs.ts @@ -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, diff --git a/backend/middlewares/user/AuthenticationMWs.ts b/backend/middlewares/user/AuthenticationMWs.ts index cd18d80a..a65fdabb 100644 --- a/backend/middlewares/user/AuthenticationMWs.ts +++ b/backend/middlewares/user/AuthenticationMWs.ts @@ -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; } diff --git a/frontend/app/gallery/share/share.gallery.component.ts b/frontend/app/gallery/share/share.gallery.component.ts index 40acc0bc..762e1628 100644 --- a/frontend/app/gallery/share/share.gallery.component.ts +++ b/frontend/app/gallery/share/share.gallery.component.ts @@ -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; } diff --git a/package.json b/package.json index c5ecb6b2..dcfaf97a 100644 --- a/package.json +++ b/package.json @@ -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",