mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-08 04:00:51 +08:00
Add DefaultAvatar to org.
This commit is contained in:
@@ -141,7 +141,7 @@ func (c *ApiController) Signup() {
|
|||||||
Type: "normal-user",
|
Type: "normal-user",
|
||||||
Password: form.Password,
|
Password: form.Password,
|
||||||
DisplayName: form.Name,
|
DisplayName: form.Name,
|
||||||
Avatar: "https://casbin.org/img/casbin.svg",
|
Avatar: organization.DefaultAvatar,
|
||||||
Email: form.Email,
|
Email: form.Email,
|
||||||
Phone: form.Phone,
|
Phone: form.Phone,
|
||||||
Affiliation: form.Affiliation,
|
Affiliation: form.Affiliation,
|
||||||
|
@@ -24,12 +24,13 @@ type Organization struct {
|
|||||||
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
||||||
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
||||||
|
|
||||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||||
WebsiteUrl string `xorm:"varchar(100)" json:"websiteUrl"`
|
WebsiteUrl string `xorm:"varchar(100)" json:"websiteUrl"`
|
||||||
Favicon string `xorm:"varchar(100)" json:"favicon"`
|
Favicon string `xorm:"varchar(100)" json:"favicon"`
|
||||||
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
|
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
|
||||||
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
||||||
PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"`
|
PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"`
|
||||||
|
DefaultAvatar string `xorm:"varchar(100)" json:"defaultAvatar"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOrganizations(owner string) []*Organization {
|
func GetOrganizations(owner string) []*Organization {
|
||||||
|
@@ -170,7 +170,9 @@ func UpdateUserForOriginal(user *User) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddUser(user *User) bool {
|
func AddUser(user *User) bool {
|
||||||
user.Id = util.GenerateId()
|
if user.Id == "" {
|
||||||
|
user.Id = util.GenerateId()
|
||||||
|
}
|
||||||
|
|
||||||
organization := GetOrganizationByUser(user)
|
organization := GetOrganizationByUser(user)
|
||||||
user.UpdateUserPassword(organization)
|
user.UpdateUserPassword(organization)
|
||||||
|
@@ -58,11 +58,13 @@ func createUserFromOriginalUser(originalUser *User, affiliationMap map[int]strin
|
|||||||
Avatar: getFullAvatarUrl(originalUser.Avatar),
|
Avatar: getFullAvatarUrl(originalUser.Avatar),
|
||||||
Email: "",
|
Email: "",
|
||||||
Phone: originalUser.Cellphone,
|
Phone: originalUser.Cellphone,
|
||||||
|
Address: []string{},
|
||||||
Affiliation: affiliation,
|
Affiliation: affiliation,
|
||||||
Score: originalUser.SchoolId,
|
Score: originalUser.SchoolId,
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
IsGlobalAdmin: false,
|
IsGlobalAdmin: false,
|
||||||
IsForbidden: originalUser.Deleted != 0,
|
IsForbidden: originalUser.Deleted != 0,
|
||||||
|
Properties: map[string]string{},
|
||||||
}
|
}
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
|
@@ -159,6 +159,33 @@ class OrganizationEditPage extends React.Component {
|
|||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
|
{i18next.t("general:Default avatar")}:
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={1}>
|
||||||
|
URL:
|
||||||
|
</Col>
|
||||||
|
<Col span={23} >
|
||||||
|
<Input prefix={<LinkOutlined/>} value={this.state.organization.defaultAvatar} onChange={e => {
|
||||||
|
this.updateOrganizationField('defaultAvatar', e.target.value);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={1}>
|
||||||
|
{i18next.t("general:Preview")}:
|
||||||
|
</Col>
|
||||||
|
<Col span={23} >
|
||||||
|
<a target="_blank" rel="noreferrer" href={this.state.organization.defaultAvatar}>
|
||||||
|
<img src={this.state.organization.defaultAvatar} alt={this.state.organization.defaultAvatar} height={90} style={{marginBottom: '20px'}}/>
|
||||||
|
</a>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,7 @@ class OrganizationListPage extends React.Component {
|
|||||||
passwordType: "plain",
|
passwordType: "plain",
|
||||||
PasswordSalt: "",
|
PasswordSalt: "",
|
||||||
phonePrefix: "86",
|
phonePrefix: "86",
|
||||||
|
defaultAvatar: "https://casbin.org/img/casbin.svg",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
"Display name": "Display name",
|
"Display name": "Display name",
|
||||||
"Personal name": "Personal name",
|
"Personal name": "Personal name",
|
||||||
"Avatar": "Avatar",
|
"Avatar": "Avatar",
|
||||||
|
"Default avatar": "Default avatar",
|
||||||
"URL": "URL",
|
"URL": "URL",
|
||||||
"Preview": "Preview",
|
"Preview": "Preview",
|
||||||
"User type": "User type",
|
"User type": "User type",
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
"Display name": "显示名称",
|
"Display name": "显示名称",
|
||||||
"Personal name": "姓名",
|
"Personal name": "姓名",
|
||||||
"Avatar": "头像",
|
"Avatar": "头像",
|
||||||
|
"Default avatar": "默认头像",
|
||||||
"URL": "链接",
|
"URL": "链接",
|
||||||
"Preview": "预览",
|
"Preview": "预览",
|
||||||
"User type": "用户类型",
|
"User type": "用户类型",
|
||||||
|
Reference in New Issue
Block a user