forked from tools/josh
parent
5abf9d8201
commit
bb9c535bb3
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "fwdekker.com",
|
||||
"version": "0.40.7",
|
||||
"version": "0.40.8",
|
||||
"description": "The source code of [my personal website](https://fwdekker.com/).",
|
||||
"author": "Felix W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
@ -24,7 +24,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||
"@types/chai": "^4.2.17",
|
||||
"@types/chai": "^4.2.18",
|
||||
"@types/js-cookie": "^2.2.6",
|
||||
"@types/mocha": "^8.2.2",
|
||||
"@types/semver": "^6.2.1",
|
||||
|
@ -39,12 +39,12 @@
|
|||
"grunt-webpack": "^4.0.3",
|
||||
"jsdom": "^16.5.3",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"mocha": "^8.3.2",
|
||||
"mocha": "^8.4.0",
|
||||
"nyc": "^15.1.0",
|
||||
"ts-loader": "^9.1.2",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.4",
|
||||
"webpack": "^5.36.2",
|
||||
"webpack": "^5.37.0",
|
||||
"webpack-cli": "^4.7.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ export class UserList {
|
|||
return false;
|
||||
|
||||
const modifiedUsers = this.users.map(user => user.name === modifiedUser.name ? modifiedUser : user);
|
||||
this.userFile.open("write"); // Empty file
|
||||
this.userFile.open("write"); // Empty file
|
||||
modifiedUsers.forEach(user => this.add(user));
|
||||
return true;
|
||||
}
|
||||
|
@ -192,16 +192,15 @@ export class User {
|
|||
* Constructs a new user.
|
||||
*
|
||||
* @param name the name of the user
|
||||
* @param password the hash of this user's password
|
||||
* @param home the path to the user's home directory, or `undefined` to use `/home/<name>`
|
||||
* @param passwordHash the hash of this user's password
|
||||
* @param home the path to the user's home directory, or an empty string to use `/home/<name>`
|
||||
* @param description the description of the user
|
||||
*/
|
||||
constructor(name: string, password: string, home: string | undefined = undefined,
|
||||
description: string | undefined = undefined) {
|
||||
constructor(name: string, passwordHash: string, home: string = "", description: string = "") {
|
||||
this.name = name;
|
||||
this.passwordHash = password;
|
||||
this.home = home ?? `/home/${name}`;
|
||||
this.description = description ?? "";
|
||||
this.passwordHash = passwordHash;
|
||||
this.home = home;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,13 +255,13 @@ export class User {
|
|||
/**
|
||||
* Sets the path to the user's home directory.
|
||||
*
|
||||
* @param home the path to the user's home directory to set
|
||||
* @param home the path to the user's home directory to set, or empty string to use `/home/<name>`
|
||||
*/
|
||||
set home(home: string) {
|
||||
if (home?.includes("|") || home?.includes("\n"))
|
||||
throw new IllegalArgumentError("Home must not contain pipe ('|') or newline character.");
|
||||
|
||||
this._home = home;
|
||||
this._home = home || `/home/${this.name}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue