Replace basic auth with cookie authentication (#440)

* Add logout functionality and button
* Make session age configurable
This commit is contained in:
WithoutPants
2020-04-08 12:51:12 +10:00
committed by GitHub
parent b3e8d1e8dd
commit 15e7756d33
73 changed files with 12297 additions and 49 deletions

View File

@@ -24,6 +24,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
>(undefined);
const [username, setUsername] = useState<string | undefined>(undefined);
const [password, setPassword] = useState<string | undefined>(undefined);
const [maxSessionAge, setMaxSessionAge] = useState<number>(0);
const [logFile, setLogFile] = useState<string | undefined>();
const [logOut, setLogOut] = useState<boolean>(true);
const [logLevel, setLogLevel] = useState<string>("Info");
@@ -43,6 +44,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
maxStreamingTranscodeSize,
username,
password,
maxSessionAge,
logFile,
logOut,
logLevel,
@@ -65,6 +67,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
);
setUsername(conf.general.username);
setPassword(conf.general.password);
setMaxSessionAge(conf.general.maxSessionAge);
setLogFile(conf.general.logFile ?? undefined);
setLogOut(conf.general.logOut);
setLogLevel(conf.general.logLevel);
@@ -339,6 +342,21 @@ export const SettingsConfigurationPanel: React.FC = () => {
Password to access Stash. Leave blank to disable user authentication
</Form.Text>
</Form.Group>
<Form.Group id="maxSessionAge">
<h6>Maximum Session Age</h6>
<Form.Control
className="col col-sm-6 text-input"
type="number"
value={maxSessionAge.toString()}
onInput={(e: React.FormEvent<HTMLInputElement>) =>
setMaxSessionAge(Number.parseInt(e.currentTarget.value, 10))
}
/>
<Form.Text className="text-muted">
Maximum idle time before a login session is expired, in seconds.
</Form.Text>
</Form.Group>
</Form.Group>
<hr />