fix: add password in body to adminAddUser

This commit is contained in:
Luke Bennett 2021-06-13 04:47:27 +01:00
parent aa57f32701
commit 80ca0b6800
No known key found for this signature in database
GPG key ID: A738E9C68D3BF31A
2 changed files with 12 additions and 6 deletions

View file

@ -73,7 +73,7 @@ export class CCashClient implements Partial<ICCashClient> {
);
}
setBal(user: string, pass: string, amount: number): Promise<number> {
setBalance(user: string, pass: string, amount: number): Promise<number> {
return this.http
.patch(`/admin/${user}/bal`, undefined, {
headers: { Password: pass },
@ -120,13 +120,18 @@ export class CCashClient implements Partial<ICCashClient> {
adminAddUser(
user: string,
pass: string,
initialPass: string,
initialBalance: number
): Promise<User> {
return this.http
.post(`/user/${user}`, undefined, {
headers: { Password: pass },
params: { init_bal: initialBalance },
})
.post(
`/user/${user}`,
{ password: initialPass },
{
headers: { Password: pass },
params: { init_bal: initialBalance },
}
)
.then(
(response) =>
this.handleError(response) || this.serialize(User, { user })

View file

@ -16,7 +16,7 @@ export interface ICCashClient {
// Meta usage
changePassword(user: string, pass: string, newPass: string): Promise<User>;
setBal(user: string, pass: string, amount: number): Promise<number>;
setBalance(user: string, pass: string, amount: number): Promise<number>;
// System usage
help(): Promise<string>;
@ -29,6 +29,7 @@ export interface ICCashClient {
adminAddUser(
user: string,
pass: string,
initialPass: number,
initialBalance: number
): Promise<User>;
deleteUser(user: string, pass: string): Promise<User>;