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

🚧 feat: show sso providers for next-auth in profile page #5303

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

cy948
Copy link
Contributor

@cy948 cy948 commented Jan 5, 2025

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

📝 补充信息 | Additional Information

  • Preview
    image

Copy link

vercel bot commented Jan 5, 2025

@cy948 is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @cy948

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@cy948 cy948 force-pushed the feat/profile-sso-providers branch from 4c3e9c6 to ff1eea3 Compare January 10, 2025 11:50
{
children: <SSOProvidersList />,
hidden: !isLoginWithNextAuth,
label: 'profile.ssoProviders',
Copy link
Contributor

Choose a reason for hiding this comment

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

需要补充i18n

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这样的描述ok吗?

profile: {
    sso: {
      loading: '正在加载已绑定的第三方账户',
      providers: '第三方账户绑定',
      unlink: '是否解绑该第三方账户 {{provider}} ?',
    },
}

效果如图:
image

@@ -97,6 +105,25 @@ export class UserModel {
};
};

getUserSSOProviders = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

这样的写法不好。更优雅的写法是:

getUserSSOProviders = async (): Promise<AdapterAccount[]> => {
    return this.db
      .select({
        expiresAt: nextauthAccounts.expires_at,
        provider: nextauthAccounts.provider,
        providerAccountId: nextauthAccounts.providerAccountId,
        scope: nextauthAccounts.scope,
        type: nextauthAccounts.type,
      })
      .from(nextauthAccounts)
      .where(eq(nextauthAccounts.userId, this.userId));
  };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

改了个写法 68ca31c

@cy948 cy948 force-pushed the feat/profile-sso-providers branch from 04763a6 to 6f02251 Compare January 19, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants