@dudousxd/nestjs-agent-dashboard 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -109,6 +109,8 @@ AgentDashboardModule.forRoot({
109
109
 
110
110
  Open `/ai-gateway`, enter the credentials, and you're in. Bad credentials get a **uniform** redirect back to the login page — the response is identical for an unknown user and a wrong password, so the endpoint never reveals which one was wrong. `POST <basePath>/auth/logout` clears the cookie.
111
111
 
112
+ Only `username` is required (non-empty) — the password is passed through to `login` verbatim, including empty, so a host that authenticates by username/email alone (password deliberately ignored) can use the built-in screen unmodified; the hook owns whether an empty password is accepted or rejected.
113
+
112
114
  Need the `login` hook to reach a DB (e.g. an `EntityManager`)? Use `forRootAsync` — `basePath`/`apiBasePath`/`guards` stay static (needed at module-build time for routing), only the auth config is resolved through DI:
113
115
 
114
116
  ```ts
@@ -1295,9 +1295,13 @@ function _ts_param4(paramIndex, decorator) {
1295
1295
  }
1296
1296
  __name(_ts_param4, "_ts_param");
1297
1297
  function isNonEmptyString(value) {
1298
- return typeof value === "string" && value !== "";
1298
+ return typeof value === "string" && value.trim() !== "";
1299
1299
  }
1300
1300
  __name(isNonEmptyString, "isNonEmptyString");
1301
+ function isString(value) {
1302
+ return typeof value === "string";
1303
+ }
1304
+ __name(isString, "isString");
1301
1305
  var AgentDashboardAuthController = class _AgentDashboardAuthController {
1302
1306
  static {
1303
1307
  __name(this, "AgentDashboardAuthController");
@@ -1330,11 +1334,11 @@ var AgentDashboardAuthController = class _AgentDashboardAuthController {
1330
1334
  const returnTo = sanitizeReturnTo(this.basePath, body?.returnTo);
1331
1335
  const username = body?.username;
1332
1336
  const password = body?.password;
1333
- if (!isNonEmptyString(username) || !isNonEmptyString(password)) {
1337
+ if (!isNonEmptyString(username) || password !== void 0 && !isString(password)) {
1334
1338
  this.redirectToLoginError(res, returnTo);
1335
1339
  return "";
1336
1340
  }
1337
- const user = await this.runLoginHook(auth, username, password);
1341
+ const user = await this.runLoginHook(auth, username.trim(), isString(password) ? password : "");
1338
1342
  if (!user) {
1339
1343
  this.redirectToLoginError(res, returnTo);
1340
1344
  return "";