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

View file

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