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

[Request] logto 切换为mail注册后因为无username传入数据库,可以加入一个mail 作为标识嘛? #3749

Closed
yelc66 opened this issue Sep 3, 2024 · 7 comments · Fixed by #4350
Labels
🌠 Feature Request New feature or request | 特性与建议 released

Comments

@yelc66
Copy link

yelc66 commented Sep 3, 2024

🥰 需求描述

image

🧐 解决方案

或是可以设置哪里解决这个问题嘛

📝 补充信息

No response

@yelc66 yelc66 added the 🌠 Feature Request New feature or request | 特性与建议 label Sep 3, 2024
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🥰 Description of requirements

image

🧐 Solution

Or where can I set up to solve this problem?

📝 Supplementary information

No response

@lobehubbot
Copy link
Member

👀 @yelc66

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@cy948
Copy link
Contributor

cy948 commented Sep 9, 2024

如果用户有name信息,也会进行显示。 你可以对用户的name信息进行更改。至于能否生效还要看 #3774 实现。 此处显示的判断逻辑:

const nickName = (s: UserStore) => {
if (!s.enableAuth()) return t('userPanel.defaultNickname', { ns: 'common' });
if (s.isSignedIn) return s.user?.fullName || s.user?.username;
return t('userPanel.anonymousNickName', { ns: 'common' });
};

LogtoProvider的处理:

profile(profile) {
// You can customize the user profile mapping here
return {
email: profile.email,
id: profile.sub,
image: profile.picture,
name: profile.name ?? profile.username,
providerAccountId: profile.sub,
};

@arvinxx
Copy link
Contributor

arvinxx commented Sep 9, 2024

@cy948 我感觉应该参考下 generic-oidc 的实现,name 那边用 name: profile.name ?? profile.username ?? profile.email

https://github.com/lobehub/lobe-chat/blob/main/src/libs/next-auth/sso-providers/generic-oidc.ts#L27-L34

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@cy948 I think we should refer to the implementation of generic-oidc. For name, use name: profile.name ?? profile.username ?? profile.email

@lobehubbot
Copy link
Member

@yelc66

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 1.22.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌠 Feature Request New feature or request | 特性与建议 released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants