Skip to content

Commit 945d902

Browse files
authored
Fix registration for setups with one organization (#4559)
* fix login and remove defaultOrganization from application.conf feature block * update changelog and migration guide * Merge branch 'master' into fix-register * remove unused var * Merge branch 'fix-register' of github.com:scalableminds/webknossos into fix-register * update snapshots * Merge branch 'master' into fix-register
1 parent ccfd33b commit 945d902

File tree

13 files changed

+22
-32
lines changed

13 files changed

+22
-32
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).
3232
- The datastore checks if a organization folder can be created before creating a new organization. [#4501](https://github.com/scalableminds/webknossos/pull/4501)
3333
- Fixed a bug where under certain circumstances groups in the tree tab were not sorted by name. [#4542](https://github.com/scalableminds/webknossos/pull/4542)
3434
- Fixed that `segmentationOpacity` could not be set anymore as part of the recommended settings for a task type. [#4545](https://github.com/scalableminds/webknossos/pull/4545)
35+
- Fixed registration for setups with one organization and not configured defaultOrganization. [#4559](https://github.com/scalableminds/webknossos/pull/4559)
3536
- Fixed a rendering error which could make some layers disappear in certain circumstances. [#4556](https://github.com/scalableminds/webknossos/pull/4556)
3637

3738
### Removed

MIGRATIONS.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project adheres to [Calendar Versioning](http://calver.org/) `0Y.0M.MICRO`.
55
User-facing changes are documented in the [changelog](CHANGELOG.md).
66

77
## Unreleased
8+
- The optional `defaultOrganization` attribute from the `features` block in `application.conf` is not used anymore and can be removed. [#4559](https://github.com/scalableminds/webknossos/pull/4559)
89

910
### Postgres Evolutions:
1011

conf/application.conf

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ features {
8484
# this part of the config is exposed as JSON via /api/features
8585
discussionBoard = "https://support.webknossos.org"
8686
discussionBoardRequiresAdmin = false
87-
defaultOrganization = ""
8887
addForeignDataset = false
8988
hideNavbarLogin = false
9089
# if isDemoInstance is true, / will always be the /spotlight page

frontend/javascripts/admin/admin_rest_api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ export async function getOpenTasksReport(teamId: string): Promise<Array<APIOpenT
11261126
// ### Organizations
11271127
export async function getDefaultOrganization(): Promise<?APIOrganization> {
11281128
// Only returns an organization if the webKnossos instance only has one organization
1129-
await Request.receiveJSON("/api/organizations/default");
1129+
return Request.receiveJSON("/api/organizations/default");
11301130
}
11311131

11321132
export function getOrganization(organizationName: string): Promise<APIOrganization> {

frontend/javascripts/admin/api_flow_types.js

-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ export type APIBuildInfo = {
517517
export type APIFeatureToggles = {
518518
+discussionBoard: string | false,
519519
+discussionBoardRequiresAdmin: boolean,
520-
+defaultOrganization: string,
521520
+addForeignDataset: boolean,
522521
+hideNavbarLogin: boolean,
523522
+isDemoInstance: boolean,

frontend/javascripts/admin/auth/registration_form.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { setActiveUserAction } from "oxalis/model/actions/user_actions";
88
import Request from "libs/request";
99
import Store from "oxalis/throttled_store";
1010
import messages from "messages";
11-
import features from "features";
1211
import { setHasOrganizationsAction } from "oxalis/model/actions/ui_actions";
1312

1413
const FormItem = Form.Item;
@@ -140,9 +139,6 @@ class RegistrationForm extends React.PureComponent<Props, State> {
140139
);
141140
}
142141

143-
const { defaultOrganization } = features();
144-
const doesDefaultOrganizationExist = this.state.organization != null;
145-
146142
return (
147143
<>
148144
<FormItem style={{ display: "none" }}>
@@ -158,7 +154,7 @@ class RegistrationForm extends React.PureComponent<Props, State> {
158154
message: messages["auth.registration_org_input"],
159155
},
160156
],
161-
initialValue: doesDefaultOrganizationExist ? defaultOrganization : undefined,
157+
initialValue: this.props.organizationName,
162158
})(<Input type="text" disabled />)}
163159
</FormItem>
164160
</>

frontend/javascripts/admin/auth/registration_view.js

+16-14
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ import { Link, useHistory } from "react-router-dom";
44
import { Spin, Row, Col, Card } from "antd";
55
import messages from "messages";
66
import Toast from "libs/toast";
7-
import { getOrganization } from "admin/admin_rest_api";
7+
import { getOrganization, getDefaultOrganization } from "admin/admin_rest_api";
88
import features from "features";
99
import RegistrationForm from "./registration_form";
1010

1111
type Props = {
12-
organizationName: string,
12+
organizationName?: string,
1313
};
1414

15-
function RegistrationView({ organizationName = "default" }: Props) {
15+
function RegistrationView({ organizationName }: Props) {
1616
const history = useHistory();
1717
const [organization, setOrganization] = useState(null);
1818
const [isLoading, setIsLoading] = useState(true);
1919

2020
useEffect(() => {
2121
(async () => {
22-
if (organizationName) {
23-
try {
24-
setIsLoading(true);
22+
setIsLoading(true);
23+
try {
24+
if (organizationName != null) {
2525
setOrganization(await getOrganization(organizationName));
26-
} finally {
27-
setIsLoading(false);
26+
} else {
27+
const defaultOrg = await getDefaultOrganization();
28+
setOrganization(defaultOrg);
2829
}
29-
} else {
30-
setOrganization(null);
30+
} finally {
3131
setIsLoading(false);
3232
}
3333
})();
@@ -45,8 +45,8 @@ function RegistrationView({ organizationName = "default" }: Props) {
4545
<RegistrationForm
4646
// The key is used to enforce a remount in case the organizationName changes.
4747
// That way, we ensure that the organization field is cleared.
48-
key={organizationName}
49-
organizationName={organizationName}
48+
key={organization.name}
49+
organizationName={organization.name}
5050
onRegistered={(isUserLoggedIn?: boolean) => {
5151
if (isUserLoggedIn) {
5252
history.goBack();
@@ -65,11 +65,13 @@ function RegistrationView({ organizationName = "default" }: Props) {
6565
} else {
6666
content = (
6767
<Card style={{ marginBottom: 24 }}>
68-
We could not find your organization.
68+
{organizationName != null
69+
? "We could not find your organization."
70+
: "We could not find a default organization to sign up for."}
6971
<br /> Please check your link or{" "}
7072
{features().isDemoInstance ? (
7173
<>
72-
<Link to="/onboarding">create a new organization</Link>.
74+
<Link to="/">create a new organization</Link>.
7375
</>
7476
) : (
7577
<>

frontend/javascripts/admin/onboarding.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const OrganizationForm = Form.create()(({ form, onComplete }) => {
257257
>
258258
{getFieldDecorator("organizationName", {
259259
rules: [{ required: true, message: "Please enter an organization name!" }],
260-
initialValue: features().defaultOrganization,
260+
initialValue: "",
261261
})(
262262
<AutoComplete
263263
size="large"

frontend/javascripts/pages/frontpage/pricing_view.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import CreditsFooter from "components/credits_footer";
66
import { SocialMediaBlock } from "pages/frontpage/features_view";
77
import { trackAction } from "oxalis/model/helpers/analytics";
88

9-
export const bgColorLight = "hsl(208, 30%, 88%)";
9+
export const bgColorLight = "hsl(214, 28%, 95%)";
1010
export const bgColorDark = "hsl(208, 100%, 46%)";
1111

1212
const PricingColumn = ({

frontend/javascripts/test/snapshots/public/test-bundle/test/backend-snapshot-tests/misc.e2e.js.md

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ Generated by [AVA](https://ava.li).
6565
{
6666
addForeignDataset: false,
6767
autoBrushReadyDatasets: [],
68-
defaultOrganization: '',
6968
discussionBoard: 'https://support.webknossos.org',
7069
discussionBoardRequiresAdmin: false,
7170
hideNavbarLogin: false,

frontend/javascripts/test/snapshots/public/test-bundle/test/backend-snapshot-tests/teams.e2e.js.md

-7
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ Generated by [AVA](https://ava.li).
5252
},
5353
]
5454

55-
## teams-getOrganizationNames()
56-
57-
[
58-
'Organization_X',
59-
'Organization_Y',
60-
]
61-
6255
## teams-getTeams()
6356

6457
[

0 commit comments

Comments
 (0)