mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 04:08:45 -05:00
feat(ui): Add local login setting (#817)
This commit is contained in:
@@ -10,6 +10,7 @@ export interface PublicSettingsResponse {
|
||||
movie4kEnabled: boolean;
|
||||
series4kEnabled: boolean;
|
||||
hideAvailable: boolean;
|
||||
localLogin: boolean;
|
||||
}
|
||||
|
||||
export interface CacheItem {
|
||||
|
||||
@@ -54,6 +54,7 @@ export interface MainSettings {
|
||||
csrfProtection: boolean;
|
||||
defaultPermissions: number;
|
||||
hideAvailable: boolean;
|
||||
localLogin: boolean;
|
||||
trustProxy: boolean;
|
||||
}
|
||||
|
||||
@@ -65,6 +66,7 @@ interface FullPublicSettings extends PublicSettings {
|
||||
movie4kEnabled: boolean;
|
||||
series4kEnabled: boolean;
|
||||
hideAvailable: boolean;
|
||||
localLogin: boolean;
|
||||
}
|
||||
|
||||
export interface NotificationAgentConfig {
|
||||
@@ -162,6 +164,7 @@ class Settings {
|
||||
csrfProtection: false,
|
||||
defaultPermissions: Permission.REQUEST,
|
||||
hideAvailable: false,
|
||||
localLogin: true,
|
||||
trustProxy: false,
|
||||
},
|
||||
plex: {
|
||||
@@ -296,6 +299,7 @@ class Settings {
|
||||
(sonarr) => sonarr.is4k && sonarr.isDefault
|
||||
),
|
||||
hideAvailable: this.data.main.hideAvailable,
|
||||
localLogin: this.data.main.localLogin,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -134,10 +134,13 @@ authRoutes.post('/login', async (req, res, next) => {
|
||||
});
|
||||
|
||||
authRoutes.post('/local', async (req, res, next) => {
|
||||
const settings = getSettings();
|
||||
const userRepository = getRepository(User);
|
||||
const body = req.body as { email?: string; password?: string };
|
||||
|
||||
if (!body.email || !body.password) {
|
||||
if (!settings.main.localLogin) {
|
||||
return res.status(500).json({ error: 'Local user login is disabled' });
|
||||
} else if (!body.email || !body.password) {
|
||||
return res
|
||||
.status(500)
|
||||
.json({ error: 'You must provide an email and a password' });
|
||||
|
||||
Reference in New Issue
Block a user