re-add the password reset link
This commit is contained in:
@@ -14,6 +14,7 @@ import TextField from '@material-ui/core/TextField';
|
|||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import DialogActions from '@material-ui/core/DialogActions';
|
import DialogActions from '@material-ui/core/DialogActions';
|
||||||
import DialogContent from '@material-ui/core/DialogContent';
|
import DialogContent from '@material-ui/core/DialogContent';
|
||||||
|
import Link from '@material-ui/core/Link';
|
||||||
|
|
||||||
import TextInput from '../../components/TextInput'
|
import TextInput from '../../components/TextInput'
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ function Login(props) {
|
|||||||
classes,
|
classes,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
|
passwordResetLink,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -152,6 +154,7 @@ function Login(props) {
|
|||||||
/>
|
/>
|
||||||
{hasError && <Typography id="oc-login-error-message" variant="subtitle2" component="span" color="error" className={classes.message}>{errorMessage}</Typography>}
|
{hasError && <Typography id="oc-login-error-message" variant="subtitle2" component="span" color="error" className={classes.message}>{errorMessage}</Typography>}
|
||||||
<div className={classes.wrapper}>
|
<div className={classes.wrapper}>
|
||||||
|
{loginFailed && passwordResetLink && <Link id="oc-login-password-reset" href={passwordResetLink} variant="subtitle2">{"Reset password?"}</Link>}
|
||||||
<br />
|
<br />
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -176,6 +179,7 @@ Login.propTypes = {
|
|||||||
loading: PropTypes.string.isRequired,
|
loading: PropTypes.string.isRequired,
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
password: PropTypes.string.isRequired,
|
password: PropTypes.string.isRequired,
|
||||||
|
passwordResetLink: PropTypes.string.isRequired,
|
||||||
errors: PropTypes.object.isRequired,
|
errors: PropTypes.object.isRequired,
|
||||||
branding: PropTypes.object,
|
branding: PropTypes.object,
|
||||||
hello: PropTypes.object,
|
hello: PropTypes.object,
|
||||||
@@ -187,7 +191,7 @@ Login.propTypes = {
|
|||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
const { loading, username, password, errors} = state.login;
|
const { loading, username, password, errors} = state.login;
|
||||||
const { branding, hello, query } = state.common;
|
const { branding, hello, query, passwordResetLink } = state.common;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading,
|
loading,
|
||||||
@@ -196,7 +200,8 @@ const mapStateToProps = (state) => {
|
|||||||
errors,
|
errors,
|
||||||
branding,
|
branding,
|
||||||
hello,
|
hello,
|
||||||
query
|
query,
|
||||||
|
passwordResetLink
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ const defaultPathPrefix = (() => {
|
|||||||
return pathPrefix;
|
return pathPrefix;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
const defaultPasswordResetLink = (() => {
|
||||||
|
const root = document.getElementById('root');
|
||||||
|
let link = root ? root.getAttribute('passwort-reset-link') : null;
|
||||||
|
if (!link || link === '__PASSWORD_RESET_LINK__') {
|
||||||
|
// Not replaced, probably we are running in debug mode or whatever. Use sane default.
|
||||||
|
link = '';
|
||||||
|
}
|
||||||
|
return link;
|
||||||
|
})();
|
||||||
|
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
hello: null,
|
hello: null,
|
||||||
branding: null,
|
branding: null,
|
||||||
@@ -27,7 +37,8 @@ const defaultState = {
|
|||||||
flow: flow,
|
flow: flow,
|
||||||
query: query,
|
query: query,
|
||||||
updateAvailable: false,
|
updateAvailable: false,
|
||||||
pathPrefix: defaultPathPrefix
|
pathPrefix: defaultPathPrefix,
|
||||||
|
passwordResetLink: defaultPasswordResetLink
|
||||||
};
|
};
|
||||||
|
|
||||||
function commonReducer(state = defaultState, action) {
|
function commonReducer(state = defaultState, action) {
|
||||||
|
|||||||
Reference in New Issue
Block a user