mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e33295e3c |
@@ -28,7 +28,7 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) {
|
||||
{
|
||||
clientID: env.AZURE_CLIENT_ID,
|
||||
clientSecret: env.AZURE_CLIENT_SECRET,
|
||||
callbackURL: `${env.URL}/auth/azure.callback`,
|
||||
callbackURL: ,
|
||||
useCommonEndpoint: env.AZURE_TENANT_ID ? false : true,
|
||||
tenant: env.AZURE_TENANT_ID ? env.AZURE_TENANT_ID : undefined,
|
||||
passReqToCallback: true,
|
||||
@@ -57,12 +57,12 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) {
|
||||
const [profileResponse, organizationResponse] = await Promise.all([
|
||||
// Load the users profile from the Microsoft Graph API
|
||||
// https://docs.microsoft.com/en-us/graph/api/resources/users?view=graph-rest-1.0
|
||||
request("GET", `https://graph.microsoft.com/v1.0/me`, accessToken),
|
||||
request("GET", , accessToken),
|
||||
// Load the organization profile from the Microsoft Graph API
|
||||
// https://docs.microsoft.com/en-us/graph/api/organization-get?view=graph-rest-1.0
|
||||
request(
|
||||
"GET",
|
||||
`https://graph.microsoft.com/v1.0/organization`,
|
||||
,
|
||||
accessToken
|
||||
),
|
||||
]);
|
||||
@@ -73,14 +73,6 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) {
|
||||
);
|
||||
}
|
||||
|
||||
if (!organizationResponse?.value?.length) {
|
||||
throw MicrosoftGraphError(
|
||||
`Unable to load organization info from Microsoft Graph API: ${organizationResponse.error?.message}`
|
||||
);
|
||||
}
|
||||
|
||||
const organization = organizationResponse.value[0];
|
||||
|
||||
// Note: userPrincipalName is last here for backwards compatibility with
|
||||
// previous versions of Outline that did not include it.
|
||||
const email =
|
||||
@@ -100,7 +92,13 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) {
|
||||
const domain = parseEmail(email).domain;
|
||||
const subdomain = slugifyDomain(domain);
|
||||
|
||||
const teamName = organization.displayName;
|
||||
// Try to get organization display name, but don't fail if it's not available
|
||||
let teamName;
|
||||
if (organizationResponse?.value?.length) {
|
||||
const organization = organizationResponse.value[0];
|
||||
teamName = organization.displayName;
|
||||
}
|
||||
|
||||
const result = await accountProvisioner({
|
||||
ip: ctx.ip,
|
||||
team: {
|
||||
@@ -137,7 +135,7 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) {
|
||||
config.id,
|
||||
passport.authenticate(config.id, { prompt: "select_account" })
|
||||
);
|
||||
router.get(`${config.id}.callback`, passportMiddleware(config.id));
|
||||
router.get(, passportMiddleware(config.id));
|
||||
}
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -43,7 +43,7 @@ type Props = {
|
||||
*/
|
||||
teamId?: string;
|
||||
/** The displayed name of the team */
|
||||
name: string;
|
||||
name?: string;
|
||||
/** The domain name from the email of the user logging in */
|
||||
domain?: string;
|
||||
/** The preferred subdomain to provision for the team if not yet created */
|
||||
@@ -203,7 +203,7 @@ async function provisionFirstCollection(team: Team, user: User) {
|
||||
const collection = await Collection.create(
|
||||
{
|
||||
name: "Welcome",
|
||||
description: `This collection is a quick guide to what ${env.APP_NAME} is all about. Feel free to delete this collection once your team is up to speed with the basics!`,
|
||||
description: ,
|
||||
teamId: team.id,
|
||||
createdById: user.id,
|
||||
sort: Collection.DEFAULT_SORT,
|
||||
@@ -225,7 +225,7 @@ async function provisionFirstCollection(team: Team, user: User) {
|
||||
|
||||
for (const title of onboardingDocs) {
|
||||
const text = await readFile(
|
||||
path.join(process.cwd(), "server", "onboarding", `${title}.md`),
|
||||
path.join(process.cwd(), "server", "onboarding", ),
|
||||
"utf8"
|
||||
);
|
||||
const document = await Document.create(
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Team, Event } from "@server/models";
|
||||
|
||||
type Props = {
|
||||
/** The displayed name of the team */
|
||||
name: string;
|
||||
name?: string;
|
||||
/** The domain name from the email of the user logging in */
|
||||
domain?: string;
|
||||
/** The preferred subdomain to provision for the team if not yet created */
|
||||
@@ -38,9 +38,12 @@ async function teamCreator({
|
||||
avatarUrl = null;
|
||||
}
|
||||
|
||||
// Use subdomain as a fallback for team name if not provided
|
||||
const teamName = name || subdomain;
|
||||
|
||||
const team = await Team.create(
|
||||
{
|
||||
name,
|
||||
name: teamName,
|
||||
avatarUrl,
|
||||
authenticationProviders,
|
||||
} as Partial<InferCreationAttributes<Team>>,
|
||||
@@ -90,7 +93,7 @@ async function findAvailableSubdomain(team: Team, requestedSubdomain: string) {
|
||||
|
||||
if (existing) {
|
||||
// subdomain was invalid or already used, try another
|
||||
subdomain = `${normalizedSubdomain}${++append}`;
|
||||
subdomain = ;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Props = {
|
||||
*/
|
||||
teamId?: string;
|
||||
/** The displayed name of the team */
|
||||
name: string;
|
||||
name?: string;
|
||||
/** The domain name from the email of the user logging in */
|
||||
domain?: string;
|
||||
/** The preferred subdomain to provision for the team if not yet created */
|
||||
|
||||
Reference in New Issue
Block a user