mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 04:08:45 -05:00
fix: add email requirement for local users (#1389)
* fix: add email requirement for local users Because of a misunderstanding, and the requirement to have a mandatory email for local users was removed, when it shouldn't have been. re #900 fix #1367 * fix: add missing check for Emby
This commit is contained in:
@@ -119,28 +119,10 @@ userSettingsRoutes.post<
|
||||
}
|
||||
|
||||
const oldEmail = user.email;
|
||||
const oldUsername = user.username;
|
||||
user.username = req.body.username;
|
||||
if (user.jellyfinUsername) {
|
||||
if (user.userType !== UserType.PLEX) {
|
||||
user.email = req.body.email || user.jellyfinUsername || user.email;
|
||||
}
|
||||
// Edge case for local users, because they have no Jellyfin username to fall back on
|
||||
// if the email is not provided
|
||||
if (user.userType === UserType.LOCAL) {
|
||||
if (req.body.email) {
|
||||
user.email = req.body.email;
|
||||
if (
|
||||
!user.username &&
|
||||
user.email !== oldEmail &&
|
||||
!oldEmail.includes('@')
|
||||
) {
|
||||
user.username = oldEmail;
|
||||
}
|
||||
} else if (req.body.username) {
|
||||
user.email = oldUsername || user.email;
|
||||
user.username = req.body.username;
|
||||
}
|
||||
}
|
||||
|
||||
const existingUser = await userRepository.findOne({
|
||||
where: { email: user.email },
|
||||
|
||||
@@ -210,7 +210,9 @@ const UserList = () => {
|
||||
username: Yup.string().required(
|
||||
intl.formatMessage(messages.validationUsername)
|
||||
),
|
||||
email: Yup.string().email(intl.formatMessage(messages.validationEmail)),
|
||||
email: Yup.string()
|
||||
.required()
|
||||
.email(intl.formatMessage(messages.validationEmail)),
|
||||
password: Yup.lazy((value) =>
|
||||
!value
|
||||
? Yup.string()
|
||||
@@ -388,6 +390,7 @@ const UserList = () => {
|
||||
<div className="form-row">
|
||||
<label htmlFor="email" className="text-label">
|
||||
{intl.formatMessage(messages.email)}
|
||||
<span className="label-required">*</span>
|
||||
</label>
|
||||
<div className="form-input-area">
|
||||
<div className="form-input-field">
|
||||
|
||||
@@ -100,7 +100,9 @@ const UserGeneralSettings = () => {
|
||||
|
||||
const UserGeneralSettingsSchema = Yup.object().shape({
|
||||
email:
|
||||
user?.id === 1
|
||||
// email is required for everybody except non-admin jellyfin users
|
||||
user?.id === 1 ||
|
||||
(user?.userType !== UserType.JELLYFIN && user?.userType !== UserType.EMBY)
|
||||
? Yup.string()
|
||||
.email(intl.formatMessage(messages.validationemailformat))
|
||||
.required(intl.formatMessage(messages.validationemailrequired))
|
||||
|
||||
Reference in New Issue
Block a user