Skip to content

Commit

Permalink
minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bpatrik committed Jul 19, 2017
1 parent e56efae commit 3bde0fc
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"../node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
"../node_modules/bootstrap/dist/css/bootstrap.css",
"styles.css"
],
Expand Down
4 changes: 4 additions & 0 deletions backend/ProjectPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class ProjectPathClass {
}

constructor() {
this.reset();
}

reset() {
this.Root = path.join(__dirname, "/../");
this.ImageFolder = this.getAbsolutePath(Config.Server.imagesFolder);
this.ThumbnailFolder = this.getAbsolutePath(Config.Server.thumbnail.folder);
Expand Down
4 changes: 3 additions & 1 deletion backend/middlewares/AdminMWs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ConfigDiagnostics} from "../model/ConfigDiagnostics";
import {ClientConfig} from "../../common/config/public/ConfigClass";
import {BasicConfigDTO} from "../../common/entities/settings/BasicConfigDTO";
import {OtherConfigDTO} from "../../common/entities/settings/OtherConfigDTO";
import set = Reflect.set;
import {ProjectPath} from "../ProjectPath";


const LOG_TAG = "[AdminMWs]";
Expand Down Expand Up @@ -165,6 +165,7 @@ export class AdminMWs {
original.Server.thumbnail = settings.server;
original.Client.Thumbnail = settings.client;
original.save();
ProjectPath.reset();
await ConfigDiagnostics.runDiagnostics();
Logger.info(LOG_TAG, "new config:");
Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t'));
Expand Down Expand Up @@ -197,6 +198,7 @@ export class AdminMWs {
original.Client.publicUrl = settings.publicUrl;
original.Client.applicationTitle = settings.applicationTitle;
original.save();
ProjectPath.reset();
await ConfigDiagnostics.runDiagnostics();
Logger.info(LOG_TAG, "new config:");
Logger.info(LOG_TAG, JSON.stringify(Config, null, '\t'));
Expand Down
13 changes: 9 additions & 4 deletions backend/model/PasswordHelper.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import * as bcryptjs from "bcryptjs";
let bcrypt;
try {
bcrypt = require("bcrypt");
} catch (err) {
bcrypt = require("bcryptjs");
}

export class PasswordHelper {
public static cryptPassword(password) {
const salt = bcryptjs.genSaltSync(10);
return bcryptjs.hashSync(password, salt);
const salt = bcrypt.genSaltSync(9);
return bcrypt.hashSync(password, salt);
}

public static comparePassword(password, encryptedPassword) {
return bcryptjs.compareSync(password, encryptedPassword);
return bcrypt.compareSync(password, encryptedPassword);
}
}
2 changes: 2 additions & 0 deletions backend/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {ConfigDiagnostics} from "./model/ConfigDiagnostics";
import _session = require('cookie-session');

const LOG_TAG = "[server]";

export class Server {

private app: any;
Expand Down Expand Up @@ -103,6 +104,7 @@ export class Server {
*/
private onError = (error: any) => {
if (error.syscall !== 'listen') {
Logger.error(LOG_TAG, 'Server error', error);
throw error;
}

Expand Down
2 changes: 1 addition & 1 deletion common/config/private/PrivateConfigClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class PrivateConfigClass extends PublicConfigClass implements IPrivateCon
updateTimeout: 1000 * 60 * 5
},
enableThreading: true,
folderPreviewSize: 5
folderPreviewSize: 2
};
private ConfigLoader: any;

Expand Down
2 changes: 1 addition & 1 deletion common/config/public/ConfigClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class PublicConfigClass {
googleApiKey: ""
},
concurrentThumbnailGenerations: 1,
enableCache: false,
enableCache: true,
enableOnScrollRendering: true,
enableOnScrollThumbnailPrioritising: true,
authenticationRequired: true,
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h1>Please log in</h1>
<!-- Button -->
<div class="col-sm-12 controls">
<button class="btn btn-primary pull-right"
[disabled]="!LoginForm.form.valid"
[disabled]="!LoginForm.form.valid || inProgress"
type="submit"
name="action">Login
</button>
Expand Down
5 changes: 4 additions & 1 deletion frontend/app/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class LoginComponent implements OnInit {
loginCredential: LoginCredential;
loginError: any = null;
title: string;
inProgress = false;

constructor(private _authService: AuthenticationService, private _navigation: NavigationService) {
this.loginCredential = new LoginCredential();
Expand All @@ -29,14 +30,16 @@ export class LoginComponent implements OnInit {
async onLogin() {
this.loginError = null;

this.inProgress = true;
try {
await this._authService.login(this.loginCredential);
} catch (error) {
if (error && error.code === ErrorCodes.CREDENTIAL_NOT_FOUND) {
this.loginError = "Wrong username or password";
return;
}
}

this.inProgress = false;
}
}

1 change: 0 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<title>Loading..</title>
<link rel="shortcut icon" href="assets/icon.png">
<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 -->

<link rel="stylesheet"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"mysql": "2.13.0",
"reflect-metadata": "0.1.10",
"ts-exif-parser": "^0.1.23",
"ts-node-iptc": "^1.0.8",
"ts-node-iptc": "^1.0.9",
"typeconfig": "1.0.4",
"typeorm": "0.0.11",
"winston": "2.3.1"
Expand Down Expand Up @@ -106,6 +106,7 @@
"zone.js": "^0.8.13"
},
"optionalDependencies": {
"bcrypt": "^1.0.2",
"gm": "^1.23.0",
"sharp": "^0.18.2"
}
Expand Down

0 comments on commit 3bde0fc

Please sign in to comment.