Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): Allow passwordless users when oauth enabled #13517

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

jedi04
Copy link
Contributor

@jedi04 jedi04 commented Oct 16, 2024

This PR fixes : #13274

It allows creation of passwordless users when Oauth is enabled in config.

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! You can use the $featureFlag.oauthEnabled store instead I think

@jedi04
Copy link
Contributor Author

jedi04 commented Oct 17, 2024

Looks good! You can use the $featureFlag.oauthEnabled store instead I think

@jrasm91 Thanks for the suggestion. I have updated it to use featureFlags.

@@ -62,7 +62,6 @@ export class UserAdminCreateDto {
@Transform(toEmail)
email!: string;

@IsNotEmpty()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this just allows empty strings, but it should probably have Optional({ nullable: true }) and still keep the is not empty. We should also test that you cannot login with an empty string of password login is enabled still

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have set password to be string in the user entity. So would it be okay to insert null values?

password?: string;

And during login we have added check for not allowing empty password

if (!user || !user.password) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah null values would be preferred over empty strings IMO

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see that we don't allow null in the database. We can change that later I think. We'll allow empty now, and move to null in the future.

@jrasm91 jrasm91 merged commit bb694ae into immich-app:main Oct 17, 2024
33 checks passed
yosit pushed a commit to yosit/immich that referenced this pull request Oct 17, 2024
…13517)

* fix(server): Allow passwordless users when oauth enabled

* fix(web): Use features flags for checking oauth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create passwordless user, even though passwords are disabled
3 participants