@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.
@@ -1253,9 +1253,13 @@ function _ts_param4(paramIndex, decorator) {
1253
1253
  }
1254
1254
  __name(_ts_param4, "_ts_param");
1255
1255
  function isNonEmptyString(value) {
1256
- return typeof value === "string" && value !== "";
1256
+ return typeof value === "string" && value.trim() !== "";
1257
1257
  }
1258
1258
  __name(isNonEmptyString, "isNonEmptyString");
1259
+ function isString(value) {
1260
+ return typeof value === "string";
1261
+ }
1262
+ __name(isString, "isString");
1259
1263
  var AgentDashboardAuthController = class _AgentDashboardAuthController {
1260
1264
  static {
1261
1265
  __name(this, "AgentDashboardAuthController");
@@ -1288,11 +1292,11 @@ var AgentDashboardAuthController = class _AgentDashboardAuthController {
1288
1292
  const returnTo = sanitizeReturnTo(this.basePath, body?.returnTo);
1289
1293
  const username = body?.username;
1290
1294
  const password = body?.password;
1291
- if (!isNonEmptyString(username) || !isNonEmptyString(password)) {
1295
+ if (!isNonEmptyString(username) || password !== void 0 && !isString(password)) {
1292
1296
  this.redirectToLoginError(res, returnTo);
1293
1297
  return "";
1294
1298
  }
1295
- const user = await this.runLoginHook(auth, username, password);
1299
+ const user = await this.runLoginHook(auth, username.trim(), isString(password) ? password : "");
1296
1300
  if (!user) {
1297
1301
  this.redirectToLoginError(res, returnTo);
1298
1302
  return "";