mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
requiring an email address for users is now configurable (#1914)
This commit is contained in:
@@ -220,6 +220,7 @@ export interface ServerInfo {
|
|||||||
version: string
|
version: string
|
||||||
gitCommit: string
|
gitCommit: string
|
||||||
allowRegistrations: boolean
|
allowRegistrations: boolean
|
||||||
|
emailAddressRequired: boolean
|
||||||
smtpEnabled: boolean
|
smtpEnabled: boolean
|
||||||
demoAccountEnabled: boolean
|
demoAccountEnabled: boolean
|
||||||
websocketEnabled: boolean
|
websocketEnabled: boolean
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ interface FormData extends ProfileModificationRequest {
|
|||||||
|
|
||||||
export function ProfileSettings() {
|
export function ProfileSettings() {
|
||||||
const profile = useAppSelector(state => state.user.profile)
|
const profile = useAppSelector(state => state.user.profile)
|
||||||
|
const serverInfos = useAppSelector(state => state.server.serverInfos)
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const { _ } = useLingui()
|
const { _ } = useLingui()
|
||||||
|
|
||||||
@@ -134,7 +135,12 @@ export function ProfileSettings() {
|
|||||||
required
|
required
|
||||||
{...form.getInputProps("currentPassword")}
|
{...form.getInputProps("currentPassword")}
|
||||||
/>
|
/>
|
||||||
<TextInput type="email" label={<Trans>E-mail</Trans>} {...form.getInputProps("email")} required />
|
<TextInput
|
||||||
|
type="email"
|
||||||
|
label={<Trans>E-mail</Trans>}
|
||||||
|
{...form.getInputProps("email")}
|
||||||
|
required={serverInfos?.emailAddressRequired}
|
||||||
|
/>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
label={<Trans>New password</Trans>}
|
label={<Trans>New password</Trans>}
|
||||||
description={<Trans>Changing password will generate a new API key</Trans>}
|
description={<Trans>Changing password will generate a new API key</Trans>}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export function RegistrationPage() {
|
|||||||
placeholder={_(msg`E-mail address`)}
|
placeholder={_(msg`E-mail address`)}
|
||||||
{...form.getInputProps("email")}
|
{...form.getInputProps("email")}
|
||||||
size="md"
|
size="md"
|
||||||
required
|
required={serverInfos.emailAddressRequired}
|
||||||
/>
|
/>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
label={<Trans>Password</Trans>}
|
label={<Trans>Password</Trans>}
|
||||||
|
|||||||
@@ -331,6 +331,12 @@ public interface CommaFeedConfiguration {
|
|||||||
@WithDefault("4")
|
@WithDefault("4")
|
||||||
int minimumPasswordLength();
|
int minimumPasswordLength();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether an email address is required when creating a user account.
|
||||||
|
*/
|
||||||
|
@WithDefault("false")
|
||||||
|
boolean emailAddressRequired();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to create a demo account the first time the app starts.
|
* Whether to create a demo account the first time the app starts.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ public class ServerInfo implements Serializable {
|
|||||||
@Schema(required = true)
|
@Schema(required = true)
|
||||||
private boolean allowRegistrations;
|
private boolean allowRegistrations;
|
||||||
|
|
||||||
|
@Schema(required = true)
|
||||||
|
private boolean emailAddressRequired;
|
||||||
|
|
||||||
@Schema(required = true)
|
@Schema(required = true)
|
||||||
private boolean smtpEnabled;
|
private boolean smtpEnabled;
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public class ServerREST {
|
|||||||
infos.setVersion(version.getVersion());
|
infos.setVersion(version.getVersion());
|
||||||
infos.setGitCommit(version.getGitCommit());
|
infos.setGitCommit(version.getGitCommit());
|
||||||
infos.setAllowRegistrations(config.users().allowRegistrations());
|
infos.setAllowRegistrations(config.users().allowRegistrations());
|
||||||
|
infos.setEmailAddressRequired(config.users().emailAddressRequired());
|
||||||
infos.setSmtpEnabled(config.passwordRecoveryEnabled());
|
infos.setSmtpEnabled(config.passwordRecoveryEnabled());
|
||||||
infos.setDemoAccountEnabled(config.users().createDemoAccount());
|
infos.setDemoAccountEnabled(config.users().createDemoAccount());
|
||||||
infos.setWebsocketEnabled(config.websocket().enabled());
|
infos.setWebsocketEnabled(config.websocket().enabled());
|
||||||
|
|||||||
Reference in New Issue
Block a user