mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
minor bugfixes
This commit is contained in:
parent
e56efae1ac
commit
3bde0fcd2a
@ -20,6 +20,7 @@
|
|||||||
"testTsconfig": "tsconfig.spec.json",
|
"testTsconfig": "tsconfig.spec.json",
|
||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
"styles": [
|
"styles": [
|
||||||
|
"../node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
|
||||||
"../node_modules/bootstrap/dist/css/bootstrap.css",
|
"../node_modules/bootstrap/dist/css/bootstrap.css",
|
||||||
"styles.css"
|
"styles.css"
|
||||||
],
|
],
|
||||||
|
@ -20,6 +20,10 @@ class ProjectPathClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
this.Root = path.join(__dirname, "/../");
|
this.Root = path.join(__dirname, "/../");
|
||||||
this.ImageFolder = this.getAbsolutePath(Config.Server.imagesFolder);
|
this.ImageFolder = this.getAbsolutePath(Config.Server.imagesFolder);
|
||||||
this.ThumbnailFolder = this.getAbsolutePath(Config.Server.thumbnail.folder);
|
this.ThumbnailFolder = this.getAbsolutePath(Config.Server.thumbnail.folder);
|
||||||
|
@ -9,7 +9,7 @@ import {ConfigDiagnostics} from "../model/ConfigDiagnostics";
|
|||||||
import {ClientConfig} from "../../common/config/public/ConfigClass";
|
import {ClientConfig} from "../../common/config/public/ConfigClass";
|
||||||
import {BasicConfigDTO} from "../../common/entities/settings/BasicConfigDTO";
|
import {BasicConfigDTO} from "../../common/entities/settings/BasicConfigDTO";
|
||||||
import {OtherConfigDTO} from "../../common/entities/settings/OtherConfigDTO";
|
import {OtherConfigDTO} from "../../common/entities/settings/OtherConfigDTO";
|
||||||
import set = Reflect.set;
|
import {ProjectPath} from "../ProjectPath";
|
||||||
|
|
||||||
|
|
||||||
const LOG_TAG = "[AdminMWs]";
|
const LOG_TAG = "[AdminMWs]";
|
||||||
@ -165,6 +165,7 @@ export class AdminMWs {
|
|||||||
original.Server.thumbnail = settings.server;
|
original.Server.thumbnail = settings.server;
|
||||||
original.Client.Thumbnail = settings.client;
|
original.Client.Thumbnail = settings.client;
|
||||||
original.save();
|
original.save();
|
||||||
|
ProjectPath.reset();
|
||||||
await ConfigDiagnostics.runDiagnostics();
|
await ConfigDiagnostics.runDiagnostics();
|
||||||
Logger.info(LOG_TAG, "new config:");
|
Logger.info(LOG_TAG, "new config:");
|
||||||
Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t'));
|
Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t'));
|
||||||
@ -197,6 +198,7 @@ export class AdminMWs {
|
|||||||
original.Client.publicUrl = settings.publicUrl;
|
original.Client.publicUrl = settings.publicUrl;
|
||||||
original.Client.applicationTitle = settings.applicationTitle;
|
original.Client.applicationTitle = settings.applicationTitle;
|
||||||
original.save();
|
original.save();
|
||||||
|
ProjectPath.reset();
|
||||||
await ConfigDiagnostics.runDiagnostics();
|
await ConfigDiagnostics.runDiagnostics();
|
||||||
Logger.info(LOG_TAG, "new config:");
|
Logger.info(LOG_TAG, "new config:");
|
||||||
Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t'));
|
Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t'));
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
import * as bcryptjs from "bcryptjs";
|
let bcrypt;
|
||||||
|
try {
|
||||||
|
bcrypt = require("bcrypt");
|
||||||
|
} catch (err) {
|
||||||
|
bcrypt = require("bcryptjs");
|
||||||
|
}
|
||||||
|
|
||||||
export class PasswordHelper {
|
export class PasswordHelper {
|
||||||
public static cryptPassword(password) {
|
public static cryptPassword(password) {
|
||||||
const salt = bcryptjs.genSaltSync(10);
|
const salt = bcrypt.genSaltSync(9);
|
||||||
return bcryptjs.hashSync(password, salt);
|
return bcrypt.hashSync(password, salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static comparePassword(password, encryptedPassword) {
|
public static comparePassword(password, encryptedPassword) {
|
||||||
return bcryptjs.compareSync(password, encryptedPassword);
|
return bcrypt.compareSync(password, encryptedPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import {ConfigDiagnostics} from "./model/ConfigDiagnostics";
|
|||||||
import _session = require('cookie-session');
|
import _session = require('cookie-session');
|
||||||
|
|
||||||
const LOG_TAG = "[server]";
|
const LOG_TAG = "[server]";
|
||||||
|
|
||||||
export class Server {
|
export class Server {
|
||||||
|
|
||||||
private app: any;
|
private app: any;
|
||||||
@ -103,6 +104,7 @@ export class Server {
|
|||||||
*/
|
*/
|
||||||
private onError = (error: any) => {
|
private onError = (error: any) => {
|
||||||
if (error.syscall !== 'listen') {
|
if (error.syscall !== 'listen') {
|
||||||
|
Logger.error(LOG_TAG, 'Server error', error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export class PrivateConfigClass extends PublicConfigClass implements IPrivateCon
|
|||||||
updateTimeout: 1000 * 60 * 5
|
updateTimeout: 1000 * 60 * 5
|
||||||
},
|
},
|
||||||
enableThreading: true,
|
enableThreading: true,
|
||||||
folderPreviewSize: 5
|
folderPreviewSize: 2
|
||||||
};
|
};
|
||||||
private ConfigLoader: any;
|
private ConfigLoader: any;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ export class PublicConfigClass {
|
|||||||
googleApiKey: ""
|
googleApiKey: ""
|
||||||
},
|
},
|
||||||
concurrentThumbnailGenerations: 1,
|
concurrentThumbnailGenerations: 1,
|
||||||
enableCache: false,
|
enableCache: true,
|
||||||
enableOnScrollRendering: true,
|
enableOnScrollRendering: true,
|
||||||
enableOnScrollThumbnailPrioritising: true,
|
enableOnScrollThumbnailPrioritising: true,
|
||||||
authenticationRequired: true,
|
authenticationRequired: true,
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<!-- Button -->
|
<!-- Button -->
|
||||||
<div class="col-sm-12 controls">
|
<div class="col-sm-12 controls">
|
||||||
<button class="btn btn-primary pull-right"
|
<button class="btn btn-primary pull-right"
|
||||||
[disabled]="!LoginForm.form.valid"
|
[disabled]="!LoginForm.form.valid || inProgress"
|
||||||
type="submit"
|
type="submit"
|
||||||
name="action">Login
|
name="action">Login
|
||||||
</button>
|
</button>
|
||||||
|
@ -14,6 +14,7 @@ export class LoginComponent implements OnInit {
|
|||||||
loginCredential: LoginCredential;
|
loginCredential: LoginCredential;
|
||||||
loginError: any = null;
|
loginError: any = null;
|
||||||
title: string;
|
title: string;
|
||||||
|
inProgress = false;
|
||||||
|
|
||||||
constructor(private _authService: AuthenticationService, private _navigation: NavigationService) {
|
constructor(private _authService: AuthenticationService, private _navigation: NavigationService) {
|
||||||
this.loginCredential = new LoginCredential();
|
this.loginCredential = new LoginCredential();
|
||||||
@ -29,14 +30,16 @@ export class LoginComponent implements OnInit {
|
|||||||
async onLogin() {
|
async onLogin() {
|
||||||
this.loginError = null;
|
this.loginError = null;
|
||||||
|
|
||||||
|
this.inProgress = true;
|
||||||
try {
|
try {
|
||||||
await this._authService.login(this.loginCredential);
|
await this._authService.login(this.loginCredential);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error && error.code === ErrorCodes.CREDENTIAL_NOT_FOUND) {
|
if (error && error.code === ErrorCodes.CREDENTIAL_NOT_FOUND) {
|
||||||
this.loginError = "Wrong username or password";
|
this.loginError = "Wrong username or password";
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.inProgress = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
<title>Loading..</title>
|
<title>Loading..</title>
|
||||||
<link rel="shortcut icon" href="assets/icon.png">
|
<link rel="shortcut icon" href="assets/icon.png">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="../node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet"/>
|
|
||||||
<!-- Latest compiled and minified CSS -->
|
<!-- Latest compiled and minified CSS -->
|
||||||
|
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"mysql": "2.13.0",
|
"mysql": "2.13.0",
|
||||||
"reflect-metadata": "0.1.10",
|
"reflect-metadata": "0.1.10",
|
||||||
"ts-exif-parser": "^0.1.23",
|
"ts-exif-parser": "^0.1.23",
|
||||||
"ts-node-iptc": "^1.0.8",
|
"ts-node-iptc": "^1.0.9",
|
||||||
"typeconfig": "1.0.4",
|
"typeconfig": "1.0.4",
|
||||||
"typeorm": "0.0.11",
|
"typeorm": "0.0.11",
|
||||||
"winston": "2.3.1"
|
"winston": "2.3.1"
|
||||||
@ -106,6 +106,7 @@
|
|||||||
"zone.js": "^0.8.13"
|
"zone.js": "^0.8.13"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
"bcrypt": "^1.0.2",
|
||||||
"gm": "^1.23.0",
|
"gm": "^1.23.0",
|
||||||
"sharp": "^0.18.2"
|
"sharp": "^0.18.2"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user