mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
cleanup
This commit is contained in:
@@ -61,12 +61,12 @@ class Main extends React.Component<Props> {
|
|||||||
if (authenticated) {
|
if (authenticated) {
|
||||||
url = "/repos/";
|
url = "/repos/";
|
||||||
}
|
}
|
||||||
if (!me) {
|
|
||||||
url = "/login";
|
|
||||||
}
|
|
||||||
if (redirectUrlFactory) {
|
if (redirectUrlFactory) {
|
||||||
url = redirectUrlFactory(this.props);
|
url = redirectUrlFactory(this.props);
|
||||||
}
|
}
|
||||||
|
if (!me) {
|
||||||
|
url = "/login";
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="main">
|
<div className="main">
|
||||||
<Switch>
|
<Switch>
|
||||||
@@ -95,6 +95,7 @@ class Main extends React.Component<Props> {
|
|||||||
renderAll={true}
|
renderAll={true}
|
||||||
props={{
|
props={{
|
||||||
authenticated,
|
authenticated,
|
||||||
|
me,
|
||||||
links
|
links
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Route, RouteComponentProps, withRouter } from "react-router-dom";
|
import { Route, RouteComponentProps, withRouter } from "react-router-dom";
|
||||||
import { getMe, isAnonymous } from "../modules/auth";
|
import { getMe } from "../modules/auth";
|
||||||
import { compose } from "redux";
|
import { compose } from "redux";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { WithTranslation, withTranslation } from "react-i18next";
|
import { WithTranslation, withTranslation } from "react-i18next";
|
||||||
@@ -63,6 +63,11 @@ class Profile extends React.Component<Props> {
|
|||||||
return this.stripEndingSlash(this.props.match.url);
|
return this.stripEndingSlash(this.props.match.url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mayChangePassword = () => {
|
||||||
|
const { me } = this.props;
|
||||||
|
return !!me?._links?.password;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const url = this.matchedUrl();
|
const url = this.matchedUrl();
|
||||||
|
|
||||||
@@ -92,7 +97,7 @@ class Profile extends React.Component<Props> {
|
|||||||
<CustomQueryFlexWrappedColumns>
|
<CustomQueryFlexWrappedColumns>
|
||||||
<PrimaryContentColumn>
|
<PrimaryContentColumn>
|
||||||
<Route path={url} exact render={() => <ProfileInfo me={me} />} />
|
<Route path={url} exact render={() => <ProfileInfo me={me} />} />
|
||||||
{me?._links?.password && (
|
{this.mayChangePassword() && (
|
||||||
<Route path={`${url}/settings/password`} render={() => <ChangeUserPassword me={me} />} />
|
<Route path={`${url}/settings/password`} render={() => <ChangeUserPassword me={me} />} />
|
||||||
)}
|
)}
|
||||||
<ExtensionPoint name="profile.route" props={extensionProps} renderAll={true} />
|
<ExtensionPoint name="profile.route" props={extensionProps} renderAll={true} />
|
||||||
@@ -105,7 +110,7 @@ class Profile extends React.Component<Props> {
|
|||||||
label={t("profile.informationNavLink")}
|
label={t("profile.informationNavLink")}
|
||||||
title={t("profile.informationNavLink")}
|
title={t("profile.informationNavLink")}
|
||||||
/>
|
/>
|
||||||
{!isAnonymous(me) && (
|
{this.mayChangePassword() && (
|
||||||
<SubNavigation
|
<SubNavigation
|
||||||
to={`${url}/settings/password`}
|
to={`${url}/settings/password`}
|
||||||
label={t("profile.settingsNavLink")}
|
label={t("profile.settingsNavLink")}
|
||||||
|
|||||||
Reference in New Issue
Block a user