Skip to content

Commit 54f9282

Browse files
authored
Merge pull request #1091 from fosrl/dev
Dev
2 parents afea958 + a39b1db commit 54f9282

File tree

15 files changed

+128
-132
lines changed

15 files changed

+128
-132
lines changed

install/config/crowdsec/profiles.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
iame: captcha_remediation
1+
name: captcha_remediation
22
filters:
33
- Alert.Remediation == true && Alert.GetScope() == "Ip" && Alert.GetScenario() contains "http"
44
decisions:
@@ -22,4 +22,4 @@ filters:
2222
decisions:
2323
- type: ban
2424
duration: 4h
25-
on_success: break
25+
on_success: break

messages/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@
11621162
"selectDomainTypeCnameName": "Single Domain (CNAME)",
11631163
"selectDomainTypeCnameDescription": "Just this specific domain. Use this for individual subdomains or specific domain entries.",
11641164
"selectDomainTypeWildcardName": "Wildcard Domain",
1165-
"selectDomainTypeWildcardDescription": "This domain and its first level of subdomains.",
1165+
"selectDomainTypeWildcardDescription": "This domain and its subdomains.",
11661166
"domainDelegation": "Single Domain",
11671167
"selectType": "Select a type",
11681168
"actions": "Actions",

server/emails/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ function createEmailClient() {
1818
host: emailConfig.smtp_host,
1919
port: emailConfig.smtp_port,
2020
secure: emailConfig.smtp_secure || false,
21-
auth: {
21+
auth: (emailConfig.smtp_user && emailConfig.smtp_pass) ? {
2222
user: emailConfig.smtp_user,
2323
pass: emailConfig.smtp_pass
24-
}
24+
} : null
2525
} as SMTPTransport.Options;
2626

2727
if (emailConfig.smtp_tls_reject_unauthorized !== undefined) {

server/lib/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from "path";
22
import { fileURLToPath } from "url";
33

44
// This is a placeholder value replaced by the build process
5-
export const APP_VERSION = "1.7.0";
5+
export const APP_VERSION = "1.7.3";
66

77
export const __FILENAME = fileURLToPath(import.meta.url);
88
export const __DIRNAME = path.dirname(__FILENAME);

server/routers/external.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,6 @@ authenticated.post(
620620

621621
authenticated.delete("/idp/:idpId", verifyUserIsServerAdmin, idp.deleteIdp);
622622

623-
authenticated.get("/idp", verifyUserIsServerAdmin, idp.listIdps);
624-
625623
authenticated.get("/idp/:idpId", verifyUserIsServerAdmin, idp.getIdp);
626624

627625
authenticated.put(

server/routers/idp/validateOidcCallback.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ export async function validateOidcCallback(
162162
);
163163
}
164164

165+
logger.debug("State verified", {
166+
urL: ensureTrailingSlash(existingIdp.idpOidcConfig.tokenUrl),
167+
expectedState,
168+
state
169+
});
170+
165171
const tokens = await client.validateAuthorizationCode(
166172
ensureTrailingSlash(existingIdp.idpOidcConfig.tokenUrl),
167173
code,

server/routers/resource/createResource.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,6 @@ async function createHttpResource(
261261
)
262262
);
263263
}
264-
if (parsedSubdomain.data.includes(".")) {
265-
return next(
266-
createHttpError(
267-
HttpCode.BAD_REQUEST,
268-
"Subdomain cannot contain a dot when using wildcard domains"
269-
)
270-
);
271-
}
272264
fullDomain = `${subdomain}.${domainRes.domains.baseDomain}`;
273265
} else {
274266
fullDomain = domainRes.domains.baseDomain;

server/routers/resource/updateResource.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,6 @@ async function updateHttpResource(
297297
)
298298
);
299299
}
300-
if (parsedSubdomain.data.includes(".")) {
301-
return next(
302-
createHttpError(
303-
HttpCode.BAD_REQUEST,
304-
"Subdomain cannot contain a dot when using wildcard domains"
305-
)
306-
);
307-
}
308300
fullDomain = `${updateData.subdomain}.${domainRes.domains.baseDomain}`;
309301
} else {
310302
fullDomain = domainRes.domains.baseDomain;

src/app/[orgId]/settings/access/users/create/page.tsx

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
SettingsSectionHeader,
1010
SettingsSectionTitle
1111
} from "@app/components/Settings";
12-
import { StrategySelect } from "@app/components/StrategySelect";
12+
import { StrategyOption, StrategySelect } from "@app/components/StrategySelect";
1313
import HeaderTitle from "@app/components/SettingsSectionTitle";
1414
import { Button } from "@app/components/ui/button";
1515
import { useParams, useRouter } from "next/navigation";
@@ -45,15 +45,10 @@ import { createApiClient } from "@app/lib/api";
4545
import { Checkbox } from "@app/components/ui/checkbox";
4646
import { ListIdpsResponse } from "@server/routers/idp";
4747
import { useTranslations } from "next-intl";
48+
import { build } from "@server/build";
4849

4950
type UserType = "internal" | "oidc";
5051

51-
interface UserTypeOption {
52-
id: UserType;
53-
title: string;
54-
description: string;
55-
}
56-
5752
interface IdpOption {
5853
idpId: number;
5954
name: string;
@@ -147,13 +142,20 @@ export default function Page() {
147142
}
148143
}, [userType, env.email.emailEnabled, internalForm, externalForm]);
149144

150-
const userTypes: UserTypeOption[] = [
145+
const [userTypes, setUserTypes] = useState<StrategyOption<string>[]>([
151146
{
152147
id: "internal",
153148
title: t("userTypeInternal"),
154-
description: t("userTypeInternalDescription")
149+
description: t("userTypeInternalDescription"),
150+
disabled: false
151+
},
152+
{
153+
id: "oidc",
154+
title: t("userTypeExternal"),
155+
description: t("userTypeExternalDescription"),
156+
disabled: true
155157
}
156-
];
158+
]);
157159

158160
useEffect(() => {
159161
if (!userType) {
@@ -177,9 +179,6 @@ export default function Page() {
177179

178180
if (res?.status === 200) {
179181
setRoles(res.data.data.roles);
180-
if (userType === "internal") {
181-
setDataLoaded(true);
182-
}
183182
}
184183
}
185184

@@ -200,24 +199,32 @@ export default function Page() {
200199

201200
if (res?.status === 200) {
202201
setIdps(res.data.data.idps);
203-
setDataLoaded(true);
204202

205203
if (res.data.data.idps.length) {
206-
userTypes.push({
207-
id: "oidc",
208-
title: t("userTypeExternal"),
209-
description: t("userTypeExternalDescription")
210-
});
204+
setUserTypes((prev) =>
205+
prev.map((type) => {
206+
if (type.id === "oidc") {
207+
return {
208+
...type,
209+
disabled: false
210+
};
211+
}
212+
return type;
213+
})
214+
);
211215
}
212216
}
213217
}
214218

215-
setDataLoaded(false);
216-
fetchRoles();
217-
if (userType !== "internal") {
218-
fetchIdps();
219+
async function fetchInitialData() {
220+
setDataLoaded(false);
221+
await fetchRoles();
222+
await fetchIdps();
223+
setDataLoaded(true);
219224
}
220-
}, [userType]);
225+
226+
fetchInitialData();
227+
}, []);
221228

222229
async function onSubmitInternal(
223230
values: z.infer<typeof internalFormSchema>
@@ -323,7 +330,7 @@ export default function Page() {
323330

324331
<div>
325332
<SettingsContainer>
326-
{!inviteLink && userTypes.length > 1 ? (
333+
{!inviteLink && build !== "saas" ? (
327334
<SettingsSection>
328335
<SettingsSectionHeader>
329336
<SettingsSectionTitle>
@@ -610,7 +617,7 @@ export default function Page() {
610617
idp || null
611618
);
612619
}}
613-
cols={3}
620+
cols={2}
614621
/>
615622
<FormMessage />
616623
</FormItem>

src/app/page.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { cleanRedirect } from "@app/lib/cleanRedirect";
1212
import { Layout } from "@app/components/Layout";
1313
import { InitialSetupCompleteResponse } from "@server/routers/auth";
1414
import { cookies } from "next/headers";
15+
import { build } from "@server/build";
1516

1617
export const dynamic = "force-dynamic";
1718

@@ -83,25 +84,27 @@ export default async function Page(props: {
8384
if (ownedOrg) {
8485
redirect(`/${ownedOrg.orgId}`);
8586
} else {
86-
redirect("/setup");
87+
if (!env.flags.disableUserCreateOrg || user.serverAdmin) {
88+
redirect("/setup");
89+
}
8790
}
8891
}
8992

90-
// return (
91-
// <UserProvider user={user}>
92-
// <Layout orgs={orgs} navItems={[]}>
93-
// <div className="w-full max-w-md mx-auto md:mt-32 mt-4">
94-
// <OrganizationLanding
95-
// disableCreateOrg={
96-
// env.flags.disableUserCreateOrg && !user.serverAdmin
97-
// }
98-
// organizations={orgs.map((org) => ({
99-
// name: org.name,
100-
// id: org.orgId
101-
// }))}
102-
// />
103-
// </div>
104-
// </Layout>
105-
// </UserProvider>
106-
// );
93+
return (
94+
<UserProvider user={user}>
95+
<Layout orgs={orgs} navItems={[]}>
96+
<div className="w-full max-w-md mx-auto md:mt-32 mt-4">
97+
<OrganizationLanding
98+
disableCreateOrg={
99+
env.flags.disableUserCreateOrg && !user.serverAdmin
100+
}
101+
organizations={orgs.map((org) => ({
102+
name: org.name,
103+
id: org.orgId
104+
}))}
105+
/>
106+
</div>
107+
</Layout>
108+
</UserProvider>
109+
);
107110
}

0 commit comments

Comments
 (0)