-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove email requirement for the user, and use the username if n…
…o email provided (#900) * fix: remove email requirement for the user, and use the username if no email provided * fix: update translations * fix: remove useless console.log * test: fix user list test * fix: disallow Plex users from changing their email
- Loading branch information
1 parent
4220855
commit d5f817e
Showing
10 changed files
with
85 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const testUser = { | ||
displayName: 'Test User', | ||
username: 'Test User', | ||
emailAddress: '[email protected]', | ||
password: 'test1234', | ||
}; | ||
|
@@ -32,7 +32,7 @@ describe('User List', () => { | |
|
||
cy.get('[data-testid=modal-title]').should('contain', 'Create Local User'); | ||
|
||
cy.get('#displayName').type(testUser.displayName); | ||
cy.get('#username').type(testUser.username); | ||
cy.get('#email').type(testUser.emailAddress); | ||
cy.get('#password').type(testUser.password); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,9 +93,14 @@ const UserGeneralSettings = () => { | |
); | ||
|
||
const UserGeneralSettingsSchema = Yup.object().shape({ | ||
email: Yup.string() | ||
.email(intl.formatMessage(messages.validationemailformat)) | ||
.required(intl.formatMessage(messages.validationemailrequired)), | ||
email: | ||
user?.id === 1 | ||
? Yup.string() | ||
.email(intl.formatMessage(messages.validationemailformat)) | ||
.required(intl.formatMessage(messages.validationemailrequired)) | ||
: Yup.string().email( | ||
intl.formatMessage(messages.validationemailformat) | ||
), | ||
discordId: Yup.string() | ||
.nullable() | ||
.matches(/^\d{17,19}$/, intl.formatMessage(messages.validationDiscordId)), | ||
|
@@ -134,7 +139,7 @@ const UserGeneralSettings = () => { | |
<Formik | ||
initialValues={{ | ||
displayName: data?.username ?? '', | ||
email: data?.email ?? '', | ||
email: data?.email?.includes('@') ? data.email : '', | ||
discordId: data?.discordId ?? '', | ||
locale: data?.locale, | ||
region: data?.region, | ||
|
@@ -157,7 +162,8 @@ const UserGeneralSettings = () => { | |
}, | ||
body: JSON.stringify({ | ||
username: values.displayName, | ||
email: values.email, | ||
email: | ||
values.email || user?.jellyfinUsername || user?.plexUsername, | ||
discordId: values.discordId, | ||
locale: values.locale, | ||
region: values.region, | ||
|
@@ -264,7 +270,9 @@ const UserGeneralSettings = () => { | |
name="displayName" | ||
type="text" | ||
placeholder={ | ||
user?.plexUsername ? user.plexUsername : user?.email | ||
user?.username || | ||
user?.jellyfinUsername || | ||
user?.plexUsername | ||
} | ||
/> | ||
</div> | ||
|
@@ -289,6 +297,7 @@ const UserGeneralSettings = () => { | |
name="email" | ||
type="text" | ||
placeholder="[email protected]" | ||
disabled={user?.plexUsername} | ||
className={ | ||
user?.warnings.find((w) => w === 'userEmailRequired') | ||
? 'border-2 border-red-400 focus:border-blue-600' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters