mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 13:44:33 -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]
|
[SerializeIgnore]
|
||||||
public string? Password { get; set; }
|
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;
|
public bool HasPassword => Password != null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -36,6 +36,10 @@ export const UserP = ResourceP("user")
|
|||||||
* The list of permissions of the user. The format of this is implementation dependent.
|
* The list of permissions of the user. The format of this is implementation dependent.
|
||||||
*/
|
*/
|
||||||
permissions: z.array(z.string()),
|
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
|
* User settings
|
||||||
*/
|
*/
|
||||||
|
@ -197,6 +197,7 @@ export const AccountSettings = () => {
|
|||||||
<ChangePasswordPopup
|
<ChangePasswordPopup
|
||||||
icon={Password}
|
icon={Password}
|
||||||
label={t("settings.account.password.label")}
|
label={t("settings.account.password.label")}
|
||||||
|
hasPassword={account.hasPassword}
|
||||||
apply={async (op, np) => await editPassword({ oldPassword: op, newPassword: np })}
|
apply={async (op, np) => await editPassword({ oldPassword: op, newPassword: np })}
|
||||||
close={close}
|
close={close}
|
||||||
/>,
|
/>,
|
||||||
@ -264,11 +265,13 @@ const ChangePopup = ({
|
|||||||
const ChangePasswordPopup = ({
|
const ChangePasswordPopup = ({
|
||||||
label,
|
label,
|
||||||
icon,
|
icon,
|
||||||
|
hasPassword,
|
||||||
apply,
|
apply,
|
||||||
close,
|
close,
|
||||||
}: {
|
}: {
|
||||||
label: string;
|
label: string;
|
||||||
icon: Icon;
|
icon: Icon;
|
||||||
|
hasPassword: boolean;
|
||||||
apply: (oldPassword: string, newPassword: string) => Promise<unknown>;
|
apply: (oldPassword: string, newPassword: string) => Promise<unknown>;
|
||||||
close: () => void;
|
close: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
@ -285,13 +288,15 @@ const ChangePasswordPopup = ({
|
|||||||
<Icon icon={icon} />
|
<Icon icon={icon} />
|
||||||
<H1 {...css({ fontSize: rem(2) })}>{label}</H1>
|
<H1 {...css({ fontSize: rem(2) })}>{label}</H1>
|
||||||
</View>
|
</View>
|
||||||
<PasswordInput
|
{hasPassword && (
|
||||||
autoComplete="current-password"
|
<PasswordInput
|
||||||
variant="big"
|
autoComplete="current-password"
|
||||||
value={oldValue}
|
variant="big"
|
||||||
onChangeText={(v) => setOldValue(v)}
|
value={oldValue}
|
||||||
placeholder={t("settings.account.password.oldPassword")}
|
onChangeText={(v) => setOldValue(v)}
|
||||||
/>
|
placeholder={t("settings.account.password.oldPassword")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
autoComplete="password-new"
|
autoComplete="password-new"
|
||||||
variant="big"
|
variant="big"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user