feat: get phone number and country from Google OAuth provider (#2965)

* feat: get phone number and country from Google OAuth provider

* feat: fix i18n
This commit is contained in:
DacongDA
2024-05-23 00:42:36 +08:00
committed by GitHub
parent bfcfb56336
commit af2a9f0374
27 changed files with 119 additions and 3 deletions

View File

@ -832,6 +832,20 @@ class ProviderEditPage extends React.Component {
</React.Fragment>
)
}
{
this.state.provider.type !== "Google" ? null : (
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("provider:Get phone number"), i18next.t("provider:Get phone number - Tooltip"))} :
</Col>
<Col span={1} >
<Switch disabled={!this.state.provider.clientId} checked={this.state.provider.disableSsl} onChange={checked => {
this.updateProviderField("disableSsl", checked);
}} />
</Col>
</Row>
)
}
{
this.state.provider.type !== "ADFS" && this.state.provider.type !== "AzureAD" && this.state.provider.type !== "AzureADB2C" && this.state.provider.type !== "Casdoor" && this.state.provider.type !== "Okta" ? null : (
<Row style={{marginTop: "20px"}} >

View File

@ -384,8 +384,7 @@ export function getAuthUrl(application, provider, method, code) {
let endpoint = authInfo[provider.type].endpoint;
let redirectUri = `${window.location.origin}/callback`;
const scope = authInfo[provider.type].scope;
let scope = authInfo[provider.type].scope;
const isShortState = (provider.type === "WeChat" && navigator.userAgent.includes("MicroMessenger")) || (provider.type === "Twitter");
const state = Util.getStateFromQueryParams(application.name, provider.name, method, isShortState);
const codeChallenge = "P3S-a7dr8bgM4bF6vOyiKkKETDl16rcAzao9F8UIL1Y"; // SHA256(Base64-URL-encode("casdoor-verifier"))
@ -396,6 +395,8 @@ export function getAuthUrl(application, provider, method, code) {
}
} else if (provider.type === "Apple") {
redirectUri = `${window.location.origin}/api/callback`;
} else if (provider.type === "Google" && provider.disableSsl) {
scope += "+https://www.googleapis.com/auth/user.phonenumbers.read";
}
if (provider.type === "Google" || provider.type === "GitHub" || provider.type === "QQ" || provider.type === "Facebook"

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name des Hosts",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Anfitrión",
"Host - Tooltip": "Nombre del anfitrión",
"IdP": "IdP = Proveedor de Identidad",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "L'adresse e-mail affichée comme expéditeur dans les e-mails envoyés",
"From name": "Nom de l'expéditeur",
"From name - Tooltip": "Le nom affiché comme expéditeur dans les e-mails envoyés",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Hôte",
"Host - Tooltip": "Nom d'hôte",
"IdP": "IdP (Identité Fournisseur)",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Tuan rumah",
"Host - Tooltip": "Nama tuan rumah",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "ホスト",
"Host - Tooltip": "ホストの名前",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "호스트",
"Host - Tooltip": "호스트의 이름",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Endereço de e-mail do remetente",
"From name": "Nome do remetente",
"From name - Tooltip": "Nome do remetente",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Nome do host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Хост",
"Host - Tooltip": "Имя хоста",
"IdP": "ИдП",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Email address of \"From\"",
"From name": "From name",
"From name - Tooltip": "Name of \"From\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Host",
"Host - Tooltip": "Name of host",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "Електронна адреса \"Від\"",
"From name": "Від імені",
"From name - Tooltip": "Назва \"Від\"",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Хост",
"Host - Tooltip": "Ім'я хоста",
"IdP": "IDP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "From address - Tooltip",
"From name": "From name",
"From name - Tooltip": "From name - Tooltip",
"Get phone number": "Get phone number",
"Get phone number - Tooltip": "If sync phone number is enabled, you should enable google people api first and add scope https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "Chủ nhà",
"Host - Tooltip": "Tên của người chủ chỗ ở",
"IdP": "IdP",

View File

@ -778,6 +778,8 @@
"From address - Tooltip": "邮件里发件人的邮箱地址",
"From name": "发件人名称",
"From name - Tooltip": "邮件里发件人的显示名称",
"Get phone number": "获取手机号码",
"Get phone number - Tooltip": "如果启用获取手机号码你需要先启用peopleApi并添加范围https://www.googleapis.com/auth/user.phonenumbers.read",
"Host": "主机",
"Host - Tooltip": "主机名",
"IdP": "身份提供商",