mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
add anonymous mode for webclient / change footer and redirects if user is anonymous / add login button if user is anonymous
This commit is contained in:
@@ -26,7 +26,7 @@ import { connect } from "react-redux";
|
||||
import { Redirect, withRouter } from "react-router-dom";
|
||||
import { compose } from "redux";
|
||||
import styled from "styled-components";
|
||||
import { getLoginFailure, isAuthenticated, isLoginPending, login } from "../modules/auth";
|
||||
import { getLoginFailure, isAnonymous, isLoginPending, login } from "../modules/auth";
|
||||
import { getLoginInfoLink, getLoginLink } from "../modules/indexResource";
|
||||
import LoginInfo from "../components/LoginInfo";
|
||||
|
||||
@@ -86,7 +86,7 @@ class Login extends React.Component<Props> {
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: any) => {
|
||||
const authenticated = isAuthenticated(state);
|
||||
const authenticated = state?.auth?.me && !isAnonymous(state.auth.me);
|
||||
const loading = isLoginPending(state);
|
||||
const error = getLoginFailure(state);
|
||||
const link = getLoginLink(state);
|
||||
|
||||
@@ -43,7 +43,9 @@ type Props = WithTranslation & {
|
||||
|
||||
class Logout extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
this.props.logout(this.props.logoutLink);
|
||||
if (this.props.logoutLink) {
|
||||
this.props.logout(this.props.logoutLink);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
import React from "react";
|
||||
import { Route, RouteComponentProps, withRouter } from "react-router-dom";
|
||||
import { getMe } from "../modules/auth";
|
||||
import { getMe, isAnonymous } from "../modules/auth";
|
||||
import { compose } from "redux";
|
||||
import { connect } from "react-redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
@@ -92,7 +92,9 @@ class Profile extends React.Component<Props> {
|
||||
<CustomQueryFlexWrappedColumns>
|
||||
<PrimaryContentColumn>
|
||||
<Route path={url} exact render={() => <ProfileInfo me={me} />} />
|
||||
<Route path={`${url}/settings/password`} render={() => <ChangeUserPassword me={me} />} />
|
||||
{me?._links?.password && (
|
||||
<Route path={`${url}/settings/password`} render={() => <ChangeUserPassword me={me} />} />
|
||||
)}
|
||||
<ExtensionPoint name="profile.route" props={extensionProps} renderAll={true} />
|
||||
</PrimaryContentColumn>
|
||||
<SecondaryNavigationColumn>
|
||||
@@ -103,14 +105,16 @@ class Profile extends React.Component<Props> {
|
||||
label={t("profile.informationNavLink")}
|
||||
title={t("profile.informationNavLink")}
|
||||
/>
|
||||
<SubNavigation
|
||||
to={`${url}/settings/password`}
|
||||
label={t("profile.settingsNavLink")}
|
||||
title={t("profile.settingsNavLink")}
|
||||
>
|
||||
<NavLink to={`${url}/settings/password`} label={t("profile.changePasswordNavLink")} />
|
||||
<ExtensionPoint name="profile.setting" props={extensionProps} renderAll={true} />
|
||||
</SubNavigation>
|
||||
{!isAnonymous(me) && (
|
||||
<SubNavigation
|
||||
to={`${url}/settings/password`}
|
||||
label={t("profile.settingsNavLink")}
|
||||
title={t("profile.settingsNavLink")}
|
||||
>
|
||||
<NavLink to={`${url}/settings/password`} label={t("profile.changePasswordNavLink")} />
|
||||
<ExtensionPoint name="profile.setting" props={extensionProps} renderAll={true} />
|
||||
</SubNavigation>
|
||||
)}
|
||||
</SecondaryNavigation>
|
||||
</SecondaryNavigationColumn>
|
||||
</CustomQueryFlexWrappedColumns>
|
||||
|
||||
Reference in New Issue
Block a user