mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Show user OpenID URIs in their profile (#1314)
This commit is contained in:
committed by
Kim "BKC" Carlbäcker
parent
e1586898b2
commit
9182a35f18
@@ -21,6 +21,7 @@ type UserOpenID struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
UID int64 `xorm:"INDEX NOT NULL"`
|
||||
URI string `xorm:"UNIQUE NOT NULL"`
|
||||
Show bool `xorm:"DEFAULT false"`
|
||||
}
|
||||
|
||||
// GetUserOpenIDs returns all openid addresses that belongs to given user.
|
||||
@@ -28,6 +29,7 @@ func GetUserOpenIDs(uid int64) ([]*UserOpenID, error) {
|
||||
openids := make([]*UserOpenID, 0, 5)
|
||||
if err := x.
|
||||
Where("uid=?", uid).
|
||||
Asc("id").
|
||||
Find(&openids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -89,6 +91,12 @@ func DeleteUserOpenID(openid *UserOpenID) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ToggleUserOpenIDVisibility toggles visibility of an openid address of given user.
|
||||
func ToggleUserOpenIDVisibility(id int64) (err error) {
|
||||
_, err = x.Exec("update user_open_id set show = not show where id = ?", id)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetUserByOpenID returns the user object by given OpenID if exists.
|
||||
func GetUserByOpenID(uri string) (*User, error) {
|
||||
if len(uri) == 0 {
|
||||
|
Reference in New Issue
Block a user