mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 05:35:25 +03:00
config option to reset admin password on startup
This commit is contained in:
parent
fafc0aab2f
commit
d6b517dc85
@ -613,6 +613,19 @@ class FrigateApp:
|
|||||||
logger.info(f"*** Password: {password} ***")
|
logger.info(f"*** Password: {password} ***")
|
||||||
logger.info("********************************************************")
|
logger.info("********************************************************")
|
||||||
logger.info("********************************************************")
|
logger.info("********************************************************")
|
||||||
|
elif self.config.auth.reset_admin_password:
|
||||||
|
password = secrets.token_hex(16)
|
||||||
|
password_hash = hash_password(
|
||||||
|
password, iterations=self.config.auth.hash_iterations
|
||||||
|
)
|
||||||
|
User.replace(username="admin", password_hash=password_hash).execute()
|
||||||
|
|
||||||
|
logger.info("********************************************************")
|
||||||
|
logger.info("********************************************************")
|
||||||
|
logger.info("*** Reset admin password set in the config. ***")
|
||||||
|
logger.info(f"*** Password: {password} ***")
|
||||||
|
logger.info("********************************************************")
|
||||||
|
logger.info("********************************************************")
|
||||||
|
|
||||||
def start(self) -> None:
|
def start(self) -> None:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
|
|||||||
@ -125,6 +125,9 @@ class UserConfig(FrigateBaseModel):
|
|||||||
|
|
||||||
class AuthConfig(FrigateBaseModel):
|
class AuthConfig(FrigateBaseModel):
|
||||||
enabled: bool = Field(default=False, title="Enable authentication")
|
enabled: bool = Field(default=False, title="Enable authentication")
|
||||||
|
reset_admin_password: bool = Field(
|
||||||
|
default=False, title="Reset the admin password on startup"
|
||||||
|
)
|
||||||
cookie_name: str = Field(
|
cookie_name: str = Field(
|
||||||
default="frigate_token", title="Name for jwt token cookie", pattern=r"^[a-z]_*$"
|
default="frigate_token", title="Name for jwt token cookie", pattern=r"^[a-z]_*$"
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user