mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Fix old-format oauth data bugs.
This commit is contained in:
parent
58c7a60220
commit
29049297d8
@ -154,6 +154,10 @@ func (c *ApiController) Login() {
|
|||||||
|
|
||||||
if form.Method == "signup" {
|
if form.Method == "signup" {
|
||||||
user := object.GetUserByField(application.Organization, provider.Type, userInfo.Id)
|
user := object.GetUserByField(application.Organization, provider.Type, userInfo.Id)
|
||||||
|
if user == nil {
|
||||||
|
user = object.GetUserByField(application.Organization, provider.Type, userInfo.Username)
|
||||||
|
}
|
||||||
|
|
||||||
if user != nil {
|
if user != nil {
|
||||||
//if object.IsForbidden(userId) {
|
//if object.IsForbidden(userId) {
|
||||||
// c.forbiddenAccountResp(userId)
|
// c.forbiddenAccountResp(userId)
|
||||||
|
@ -130,11 +130,26 @@ class UserEditPage extends React.Component {
|
|||||||
renderIdp(provider) {
|
renderIdp(provider) {
|
||||||
const linkedValue = this.state.user[provider.type.toLowerCase()];
|
const linkedValue = this.state.user[provider.type.toLowerCase()];
|
||||||
const profileUrl = this.getProviderLink(provider);
|
const profileUrl = this.getProviderLink(provider);
|
||||||
|
const id = this.getUserProperty(provider.type, "id");
|
||||||
const username = this.getUserProperty(provider.type, "username");
|
const username = this.getUserProperty(provider.type, "username");
|
||||||
const displayName = this.getUserProperty(provider.type, "displayname");
|
const displayName = this.getUserProperty(provider.type, "displayName");
|
||||||
// const email = this.getUserProperty(provider.type, "email");
|
const email = this.getUserProperty(provider.type, "email");
|
||||||
const avatarUrl = this.getUserProperty(provider.type, "avatarUrl");
|
let avatarUrl = this.getUserProperty(provider.type, "avatarUrl");
|
||||||
const name = (username === undefined) ? displayName : `${displayName} (${username})`;
|
|
||||||
|
if (avatarUrl === "" || avatarUrl === undefined) {
|
||||||
|
avatarUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAQAAACROWYpAAAAHElEQVR42mNkoAAwjmoe1TyqeVTzqOZRzcNZMwB18wAfEFQkPQAAAABJRU5ErkJggg==";
|
||||||
|
}
|
||||||
|
|
||||||
|
let name = (username === undefined) ? displayName : `${displayName} (${username})`;
|
||||||
|
if (name === undefined) {
|
||||||
|
if (id !== undefined) {
|
||||||
|
name = id;
|
||||||
|
} else if (email !== undefined) {
|
||||||
|
name = email;
|
||||||
|
} else {
|
||||||
|
name = linkedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row key={provider.name} style={{marginTop: '20px'}} >
|
<Row key={provider.name} style={{marginTop: '20px'}} >
|
||||||
|
Loading…
x
Reference in New Issue
Block a user