mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 13:00:13 +02:00
add LEGACY_AUTH env variable (#1473)
This commit is contained in:
@@ -52,6 +52,7 @@ const LoginRoute = () => {
|
||||
const serverType = window.SERVER_TYPE ? toServerType(window.SERVER_TYPE) : null;
|
||||
const serverName = window.SERVER_NAME || '';
|
||||
const serverUrl = window.SERVER_URL || '';
|
||||
const legacyAuth = isServerLock ? Boolean(window.LEGACY_AUTHENTICATION) || false : false;
|
||||
|
||||
const config = [
|
||||
{
|
||||
@@ -122,7 +123,7 @@ const LoginRoute = () => {
|
||||
const data: AuthenticationResponse | undefined = await authFunction(
|
||||
serverUrl,
|
||||
{
|
||||
legacy: false,
|
||||
legacy: legacyAuth,
|
||||
password: values.password,
|
||||
username: values.username,
|
||||
},
|
||||
|
||||
@@ -94,9 +94,12 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
|
||||
const { addServer, setCurrentServer } = useAuthStoreActions();
|
||||
const { servers: discovered } = useAutodiscovery();
|
||||
|
||||
const isServerLock = Boolean(window.SERVER_LOCK) || false;
|
||||
const legacyAuthDefault = isServerLock ? Boolean(window.LEGACY_AUTHENTICATION) || false : false;
|
||||
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
legacyAuth: false,
|
||||
legacyAuth: legacyAuthDefault,
|
||||
name:
|
||||
(localSettings ? localSettings.env.SERVER_NAME : window.SERVER_NAME) || 'My Server',
|
||||
password: '',
|
||||
@@ -113,9 +116,6 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
|
||||
},
|
||||
});
|
||||
|
||||
// server lock for web is only true if lock is true *and* all other properties are set
|
||||
const isServerLock = Boolean(window.SERVER_LOCK) || false;
|
||||
|
||||
const isSubmitDisabled = !form.values.name || !form.values.url || !form.values.username;
|
||||
|
||||
const fillServerDetails = (server: DiscoveredServerItem) => {
|
||||
@@ -308,6 +308,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
|
||||
)}
|
||||
{form.values.type === ServerType.SUBSONIC && (
|
||||
<Checkbox
|
||||
disabled={isServerLock}
|
||||
label={t('form.addServer.input', {
|
||||
context: 'legacyAuthentication',
|
||||
postProcess: 'titleCase',
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
ANALYTICS_DISABLED?: boolean | string;
|
||||
LEGACY_AUTHENTICATION?: boolean;
|
||||
SERVER_LOCK?: boolean;
|
||||
SERVER_NAME?: string;
|
||||
SERVER_TYPE?: string;
|
||||
|
||||
Reference in New Issue
Block a user