mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
Improve provider logos.
This commit is contained in:
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Link} from "react-router-dom";
|
import {Link} from "react-router-dom";
|
||||||
import {Button, Popconfirm, Table} from 'antd';
|
import {Button, Popconfirm, Table, Tooltip} from 'antd';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
import * as ProviderBackend from "./backend/ProviderBackend";
|
import * as ProviderBackend from "./backend/ProviderBackend";
|
||||||
@ -142,7 +142,11 @@ class ProviderListPage extends React.Component {
|
|||||||
return text;
|
return text;
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<img width={30} height={30} src={Provider.getAuthLogo(record)} alt={record.displayName} />
|
<Tooltip title={record.type}>
|
||||||
|
<a target="_blank" rel="noreferrer" href={Provider.getAuthHomepage(record)}>
|
||||||
|
<img width={30} height={30} src={Provider.getAuthLogo(record)} alt={record.displayName} />
|
||||||
|
</a>
|
||||||
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,20 @@ export function getAuthLogo(provider) {
|
|||||||
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
|
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAuthHomepage(provider) {
|
||||||
|
const endpoint = authInfo[provider.type].endpoint;
|
||||||
|
const urlObj = new URL(endpoint);
|
||||||
|
|
||||||
|
let host = urlObj.host;
|
||||||
|
let tokens = host.split(".");
|
||||||
|
if (tokens.length > 2) {
|
||||||
|
tokens = tokens.slice(1);
|
||||||
|
}
|
||||||
|
host = tokens.join(".");
|
||||||
|
|
||||||
|
return `${urlObj.protocol}//${host}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function getAuthUrl(application, provider, method) {
|
export function getAuthUrl(application, provider, method) {
|
||||||
if (application === null || provider === null) {
|
if (application === null || provider === null) {
|
||||||
return "";
|
return "";
|
||||||
|
Reference in New Issue
Block a user