-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow hotlink to organization-specific sign-up form #2898
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fb038fb
implement sign up hotlink
philippotto 0673972
use popover for the invite-users-link; use organization-name instead …
philippotto 07c7df2
update changelog and use displayName instead of displayname
philippotto b9a7c8b
Merge branch 'master' into signuphotlink
philippotto fcc4fc9
fix snapshots
philippotto ee2eb9e
Merge branch 'signuphotlink' of github.com:scalableminds/webknossos i…
philippotto 20a1b0a
Merge branch 'master' of github.com:scalableminds/webknossos into sig…
philippotto 7e3d8b1
update snapshots
philippotto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,51 @@ import RegistrationForm from "./registration_form"; | |
|
||
type Props = { | ||
history: RouterHistory, | ||
organizationName: ?string, | ||
}; | ||
|
||
class RegistrationView extends React.PureComponent<Props> { | ||
getGreetingCard() { | ||
const { organizationName } = this.props; | ||
if (organizationName) { | ||
return ( | ||
<Card style={{ marginBottom: 24 }}> | ||
You were invited to join the organization “{organizationName}”!<br /> In case | ||
you do not know this organization, contact{" "} | ||
<a href="mailto:[email protected]">[email protected]</a> to get more | ||
information about how to get to use webKnossos. | ||
</Card> | ||
); | ||
} | ||
|
||
return ( | ||
<Card style={{ marginBottom: 24 }}> | ||
Not a member of the listed organizations?<br /> Contact{" "} | ||
<a href="mailto:[email protected]">[email protected]</a> to get more information | ||
about how to get to use webKnossos. | ||
</Card> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Row type="flex" justify="center" style={{ padding: 50 }} align="middle"> | ||
<Col span={8}> | ||
<h3>Registration</h3> | ||
<Card style={{ marginBottom: 24 }}> | ||
Not a member of the listed organizations?<br /> Contact{" "} | ||
<a href="mailto:[email protected]">[email protected]</a> to get more | ||
information about how to get to use webKnossos. | ||
</Card> | ||
{this.getGreetingCard()} | ||
<RegistrationForm | ||
// The key is used to enforce a remount in case the organizationName changes. | ||
// That way, we ensure that the organization field is cleared. | ||
key={this.props.organizationName || "default registration form key"} | ||
organizationName={this.props.organizationName} | ||
onRegistered={() => { | ||
Toast.success(messages["auth.account_created"]); | ||
this.props.history.push("/auth/login"); | ||
}} | ||
onOrganizationNameNotFound={() => { | ||
Toast.error(messages["auth.invalid_organization_name"]); | ||
this.props.history.push("/auth/register"); | ||
}} | ||
/> | ||
<Link to="/auth/login">Already have an account? Login instead.</Link> | ||
</Col> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import pako from "pako"; | |
import type { APIUserType } from "admin/api_flow_types"; | ||
|
||
type Comparator<T> = (T, T) => -1 | 0 | 1; | ||
type UrlParamsType = { [key: string]: string | boolean }; | ||
|
||
function swap(arr, a, b) { | ||
let tmp; | ||
|
@@ -226,12 +227,16 @@ const Utils = { | |
return user.isAdmin || this.isUserTeamManager(user); | ||
}, | ||
|
||
getUrlParamsObject(): { [key: string]: string | boolean } { | ||
getUrlParamsObject(): UrlParamsType { | ||
return this.getUrlParamsObjectFromString(location.search); | ||
}, | ||
|
||
getUrlParamsObjectFromString(str: string): UrlParamsType { | ||
// Parse the URL parameters as objects and return it or just a single param | ||
return location.search | ||
return str | ||
.substring(1) | ||
.split("&") | ||
.reduce((result, value): void => { | ||
.reduce((result: UrlParamsType, value: string): UrlParamsType => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
const parts = value.split("="); | ||
if (parts[0]) { | ||
const key = decodeURIComponent(parts[0]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my understanding this error can only be triggered if the user already is on the register page. So I'd say there's no need to push this to the history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure I get what you mean. If this error happens, the user is on
/auth/register?organizationName=someInvalidOrgName
. Then, he should be redirected to/auth/register
, so that the dropdown appears again. Or do you mean that something likehistory.replace
should be used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you're right. I didn't get that this line was being used to "get rid" of the
organizationName
url parameter :)