diff --git a/back/src/Kyoo.Abstractions/Models/Resources/User.cs b/back/src/Kyoo.Abstractions/Models/Resources/User.cs index 3ee69773..2f049b7f 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/User.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/User.cs @@ -56,6 +56,9 @@ namespace Kyoo.Abstractions.Models [SerializeIgnore] public string? Password { get; set; } + /// + /// Does the user can sign-in with a password or only via oidc? + /// public bool HasPassword => Password != null; /// diff --git a/front/packages/models/src/resources/user.ts b/front/packages/models/src/resources/user.ts index eaa56067..0b47d830 100644 --- a/front/packages/models/src/resources/user.ts +++ b/front/packages/models/src/resources/user.ts @@ -36,6 +36,10 @@ export const UserP = ResourceP("user") * The list of permissions of the user. The format of this is implementation dependent. */ permissions: z.array(z.string()), + /** + * Does the user can sign-in with a password or only via oidc? + */ + hasPassword: z.boolean().default(true), /** * User settings */ diff --git a/front/packages/ui/src/settings/account.tsx b/front/packages/ui/src/settings/account.tsx index ae79972f..237f259b 100644 --- a/front/packages/ui/src/settings/account.tsx +++ b/front/packages/ui/src/settings/account.tsx @@ -197,6 +197,7 @@ export const AccountSettings = () => { await editPassword({ oldPassword: op, newPassword: np })} close={close} />, @@ -264,11 +265,13 @@ const ChangePopup = ({ const ChangePasswordPopup = ({ label, icon, + hasPassword, apply, close, }: { label: string; icon: Icon; + hasPassword: boolean; apply: (oldPassword: string, newPassword: string) => Promise; close: () => void; }) => { @@ -285,13 +288,15 @@ const ChangePasswordPopup = ({

{label}

- setOldValue(v)} - placeholder={t("settings.account.password.oldPassword")} - /> + {hasPassword && ( + setOldValue(v)} + placeholder={t("settings.account.password.oldPassword")} + /> + )}