Client - add application configuration in Application Admin - #15
This commit is contained in:
@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next'
|
||||
import { Helmet } from 'react-helmet'
|
||||
|
||||
import { history } from '../../index'
|
||||
import { isRegistrationAllowed } from '../../utils'
|
||||
|
||||
export default function Form(props) {
|
||||
const { t } = useTranslation()
|
||||
@ -22,7 +21,7 @@ export default function Form(props) {
|
||||
<div className="col-md-6">
|
||||
<hr />
|
||||
<br />
|
||||
{props.formType === 'register' && !isRegistrationAllowed ? (
|
||||
{props.formType === 'register' && !props.isRegistrationAllowed ? (
|
||||
<div className="card">
|
||||
<div className="card-body">Registration is disabled.</div>
|
||||
<div className="card-body">
|
||||
|
@ -7,15 +7,23 @@ import { Link } from 'react-router-dom'
|
||||
|
||||
import Message from '../Common/Message'
|
||||
import { deletePicture, uploadPicture } from '../../actions/user'
|
||||
import { apiUrl, fileSizeLimit } from '../../utils'
|
||||
import { apiUrl, getFileSize } from '../../utils'
|
||||
|
||||
function Profile({ message, onDeletePicture, onUploadPicture, t, user }) {
|
||||
function Profile({
|
||||
appConfig,
|
||||
message,
|
||||
onDeletePicture,
|
||||
onUploadPicture,
|
||||
t,
|
||||
user,
|
||||
}) {
|
||||
const createdAt = user.created_at
|
||||
? format(new Date(user.created_at), 'dd/MM/yyyy HH:mm')
|
||||
: ''
|
||||
const birthDate = user.birth_date
|
||||
? format(new Date(user.birth_date), 'dd/MM/yyyy')
|
||||
: ''
|
||||
const fileSizeLimit = getFileSize(appConfig.max_single_file_size)
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
@ -118,6 +126,7 @@ function Profile({ message, onDeletePicture, onUploadPicture, t, user }) {
|
||||
export default withTranslation()(
|
||||
connect(
|
||||
state => ({
|
||||
appConfig: state.application.config,
|
||||
message: state.message,
|
||||
user: state.user,
|
||||
}),
|
||||
|
@ -42,6 +42,7 @@ class UserForm extends React.Component {
|
||||
render() {
|
||||
const {
|
||||
formType,
|
||||
isRegistrationAllowed,
|
||||
message,
|
||||
messages,
|
||||
onHandleUserFormSubmit,
|
||||
@ -56,6 +57,7 @@ class UserForm extends React.Component {
|
||||
<div>
|
||||
<Message message={message} messages={messages} t={t} />
|
||||
<Form
|
||||
isRegistrationAllowed={isRegistrationAllowed}
|
||||
formType={formType}
|
||||
userForm={formData}
|
||||
onHandleFormChange={event => this.onHandleFormChange(event)}
|
||||
@ -73,6 +75,7 @@ class UserForm extends React.Component {
|
||||
export default withTranslation()(
|
||||
connect(
|
||||
state => ({
|
||||
isRegistrationAllowed: state.application.config.is_registration_enabled,
|
||||
location: state.router.location,
|
||||
message: state.message,
|
||||
messages: state.messages,
|
||||
|
Reference in New Issue
Block a user