[release] v0.3.5 Let's Encrypt improvements

This commit is contained in:
Yann Stepienik 2023-05-04 18:15:28 +01:00
parent 09af871f5a
commit dba97aca00
6 changed files with 29 additions and 4 deletions

View file

@ -165,6 +165,7 @@ const ConfigManagement = () => {
<OutlinedInput
id="MongoDB-login"
type="password"
autoComplete='new-password'
value={formik.values.MongoDB}
name="MongoDB"
onBlur={formik.handleBlur}
@ -324,6 +325,7 @@ const ConfigManagement = () => {
<CosmosInputPassword
label="SMTP Password"
name="Email_Password"
autoComplete='new-password'
formik={formik}
helperText="SMTP Password"
noStrength

View file

@ -52,7 +52,7 @@ export const CosmosInputText = ({ name, style, multiline, type, placeholder, onC
</Grid>
}
export const CosmosInputPassword = ({ name, noStrength, type, placeholder, onChange, label, formik }) => {
export const CosmosInputPassword = ({ name, noStrength, type, placeholder, autoComplete, onChange, label, formik }) => {
const [level, setLevel] = React.useState();
const [showPassword, setShowPassword] = React.useState(false);
const handleClickShowPassword = () => {
@ -80,6 +80,7 @@ export const CosmosInputPassword = ({ name, noStrength, type, placeholder, onCha
type={showPassword ? 'text' : 'password'}
value={formik.values[name]}
name={name}
autoComplete={autoComplete}
onBlur={formik.handleBlur}
onChange={(e) => {
changePassword(e.target.value);

View file

@ -214,6 +214,26 @@ const NewInstall = () => {
initialValues={{
HTTPSCertificateMode: "LETSENCRYPT"
}}
validationSchema={Yup.object().shape({
SSLEmail: Yup.string().when('HTTPSCertificateMode', {
is: "LETSENCRYPT",
then: Yup.string().email().required(),
otherwise: Yup.string().email(),
}),
TLSKey: Yup.string().when('HTTPSCertificateMode', {
is: "PROVIDED",
then: Yup.string().required(),
}),
TLSCert: Yup.string().when('HTTPSCertificateMode', {
is: "PROVIDED",
then: Yup.string().required(),
}),
Hostname: Yup.string().when('HTTPSCertificateMode', {
is: "LETSENCRYPT",
then: Yup.string().required().matches(/^((?!localhost|\d+\.\d+\.\d+\.\d+)[a-zA-Z0-9\-]{1,63}\.)+[a-zA-Z]{2,63}$/, 'Let\'s Encrypt only accepts domain names'),
otherwise: Yup.string().required()
}),
})}
onSubmit={async (values, { setErrors, setStatus, setSubmitting }) => {
try {
setSubmitting(true);
@ -229,7 +249,7 @@ const NewInstall = () => {
setStatus({ success: true });
} catch (error) {
setStatus({ success: false });
setErrors({ submit: error.message });
setErrors({ submit: "Please check you have filled all the inputs properly" });
setSubmitting(false);
}
}}>

View file

@ -75,7 +75,7 @@ export const ValidateRouteSchema = Yup.object().shape({
Host: Yup.string().when('UseHost', {
is: true,
then: Yup.string().required('Host is required')
.matches(/[\.|\:]/, 'Host must be full domain ([sub.]domain.com) or an IP')
.matches(/[\.|\:]/, 'Host must be full domain ([sub.]domain.com) or an IP (IPs won\'t work with Let\'s Encrypt!)')
}),
PathPrefix: Yup.string().when('UsePathPrefix', {

View file

@ -1,6 +1,6 @@
{
"name": "cosmos-server",
"version": "0.3.4",
"version": "0.3.5",
"description": "",
"main": "test-server.js",
"bugs": {

View file

@ -60,6 +60,8 @@ func startHTTPSServer(router *mux.Router, tlsCert string, tlsKey string) {
if errSimCert != nil {
// Temporary before we have a better way to handle this
utils.Error("simplecert init failed, HTTPS wont renew", errSimCert)
startHTTPServer(router)
return
}
}