mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Remove old-password form on reset-pasword menu if user does not have one
This commit is contained in:
parent
633db89031
commit
5827a18866
@ -56,6 +56,9 @@ namespace Kyoo.Abstractions.Models
|
||||
[SerializeIgnore]
|
||||
public string? Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Does the user can sign-in with a password or only via oidc?
|
||||
/// </summary>
|
||||
public bool HasPassword => Password != null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -197,6 +197,7 @@ export const AccountSettings = () => {
|
||||
<ChangePasswordPopup
|
||||
icon={Password}
|
||||
label={t("settings.account.password.label")}
|
||||
hasPassword={account.hasPassword}
|
||||
apply={async (op, np) => 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<unknown>;
|
||||
close: () => void;
|
||||
}) => {
|
||||
@ -285,13 +288,15 @@ const ChangePasswordPopup = ({
|
||||
<Icon icon={icon} />
|
||||
<H1 {...css({ fontSize: rem(2) })}>{label}</H1>
|
||||
</View>
|
||||
<PasswordInput
|
||||
autoComplete="current-password"
|
||||
variant="big"
|
||||
value={oldValue}
|
||||
onChangeText={(v) => setOldValue(v)}
|
||||
placeholder={t("settings.account.password.oldPassword")}
|
||||
/>
|
||||
{hasPassword && (
|
||||
<PasswordInput
|
||||
autoComplete="current-password"
|
||||
variant="big"
|
||||
value={oldValue}
|
||||
onChangeText={(v) => setOldValue(v)}
|
||||
placeholder={t("settings.account.password.oldPassword")}
|
||||
/>
|
||||
)}
|
||||
<PasswordInput
|
||||
autoComplete="password-new"
|
||||
variant="big"
|
||||
|
Loading…
x
Reference in New Issue
Block a user