mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-09-14 19:02:35 +00:00
Introducing the Setup Wizard for creating the first user
- no longer setup a default - still able to do that with env vars however
This commit is contained in:
@@ -88,15 +88,19 @@ interface PostArgs {
|
||||
url: string;
|
||||
params?: queryString.StringifiableRecord;
|
||||
data?: any;
|
||||
noAuth?: boolean;
|
||||
}
|
||||
|
||||
export async function post({ url, params, data }: PostArgs, abortController?: AbortController) {
|
||||
export async function post({ url, params, data, noAuth }: PostArgs, abortController?: AbortController) {
|
||||
const apiUrl = buildUrl({ url, params });
|
||||
const method = "POST";
|
||||
|
||||
let headers = {
|
||||
...buildAuthHeader(),
|
||||
};
|
||||
let headers: Record<string, string> = {};
|
||||
if (!noAuth) {
|
||||
headers = {
|
||||
...buildAuthHeader(),
|
||||
};
|
||||
}
|
||||
|
||||
let body: string | FormData | undefined;
|
||||
// Check if the data is an instance of FormData
|
||||
|
@@ -1,12 +1,27 @@
|
||||
import * as api from "./base";
|
||||
import type { User } from "./models";
|
||||
|
||||
export async function createUser(item: User, abortController?: AbortController): Promise<User> {
|
||||
export interface AuthOptions {
|
||||
type: string;
|
||||
secret: string;
|
||||
}
|
||||
|
||||
export interface NewUser {
|
||||
name: string;
|
||||
nickname: string;
|
||||
email: string;
|
||||
isDisabled?: boolean;
|
||||
auth?: AuthOptions;
|
||||
roles?: string[];
|
||||
}
|
||||
|
||||
export async function createUser(item: NewUser, noAuth?: boolean, abortController?: AbortController): Promise<User> {
|
||||
return await api.post(
|
||||
{
|
||||
url: "/users",
|
||||
// todo: only use whitelist of fields for this data
|
||||
data: item,
|
||||
noAuth,
|
||||
},
|
||||
abortController,
|
||||
);
|
||||
|
@@ -3,6 +3,7 @@ import type { AppVersion } from "./models";
|
||||
export interface HealthResponse {
|
||||
status: string;
|
||||
version: AppVersion;
|
||||
setup: boolean;
|
||||
}
|
||||
|
||||
export interface TokenResponse {
|
||||
|
Reference in New Issue
Block a user