mirror of https://github.com/go-gitea/gitea.git
drop oauth2 feature support
parent
562e47f31c
commit
3fb1b6a608
@ -1,106 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
type OauthType int
|
||||
|
||||
const (
|
||||
GITHUB OauthType = iota + 1
|
||||
GOOGLE
|
||||
TWITTER
|
||||
QQ
|
||||
WEIBO
|
||||
BITBUCKET
|
||||
FACEBOOK
|
||||
)
|
||||
|
||||
var (
|
||||
ErrOauth2RecordNotExist = errors.New("OAuth2 record does not exist")
|
||||
ErrOauth2NotAssociated = errors.New("OAuth2 is not associated with user")
|
||||
)
|
||||
|
||||
type Oauth2 struct {
|
||||
Id int64
|
||||
Uid int64 `xorm:"unique(s)"` // userId
|
||||
User *User `xorm:"-"`
|
||||
Type int `xorm:"unique(s) unique(oauth)"` // twitter,github,google...
|
||||
Identity string `xorm:"unique(s) unique(oauth)"` // id..
|
||||
Token string `xorm:"TEXT not null"`
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
Updated time.Time
|
||||
HasRecentActivity bool `xorm:"-"`
|
||||
}
|
||||
|
||||
func BindUserOauth2(userId, oauthId int64) error {
|
||||
_, err := x.Id(oauthId).Update(&Oauth2{Uid: userId})
|
||||
return err
|
||||
}
|
||||
|
||||
func AddOauth2(oa *Oauth2) error {
|
||||
_, err := x.Insert(oa)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetOauth2(identity string) (oa *Oauth2, err error) {
|
||||
oa = &Oauth2{Identity: identity}
|
||||
isExist, err := x.Get(oa)
|
||||
if err != nil {
|
||||
return
|
||||
} else if !isExist {
|
||||
return nil, ErrOauth2RecordNotExist
|
||||
} else if oa.Uid == -1 {
|
||||
return oa, ErrOauth2NotAssociated
|
||||
}
|
||||
oa.User, err = GetUserByID(oa.Uid)
|
||||
return oa, err
|
||||
}
|
||||
|
||||
func GetOauth2ById(id int64) (oa *Oauth2, err error) {
|
||||
oa = new(Oauth2)
|
||||
has, err := x.Id(id).Get(oa)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrOauth2RecordNotExist
|
||||
}
|
||||
return oa, nil
|
||||
}
|
||||
|
||||
// UpdateOauth2 updates given OAuth2.
|
||||
func UpdateOauth2(oa *Oauth2) error {
|
||||
_, err := x.Id(oa.Id).AllCols().Update(oa)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetOauthByUserId returns list of oauthes that are related to given user.
|
||||
func GetOauthByUserId(uid int64) ([]*Oauth2, error) {
|
||||
socials := make([]*Oauth2, 0, 5)
|
||||
err := x.Find(&socials, Oauth2{Uid: uid})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, social := range socials {
|
||||
social.HasRecentActivity = social.Updated.Add(7 * 24 * time.Hour).After(time.Now())
|
||||
}
|
||||
return socials, err
|
||||
}
|
||||
|
||||
// DeleteOauth2ById deletes a oauth2 by ID.
|
||||
func DeleteOauth2ById(id int64) error {
|
||||
_, err := x.Delete(&Oauth2{Id: id})
|
||||
return err
|
||||
}
|
||||
|
||||
// CleanUnbindOauth deletes all unbind OAuthes.
|
||||
func CleanUnbindOauth() error {
|
||||
_, err := x.Delete(&Oauth2{Uid: -1})
|
||||
return err
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,333 +0,0 @@
|
||||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package social
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/macaron-contrib/oauth2"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
type BasicUserInfo struct {
|
||||
Identity string
|
||||
Name string
|
||||
Email string
|
||||
}
|
||||
|
||||
type SocialConnector interface {
|
||||
Type() int
|
||||
UserInfo(*oauth2.Token, *url.URL) (*BasicUserInfo, error)
|
||||
}
|
||||
|
||||
var (
|
||||
SocialMap = make(map[string]SocialConnector)
|
||||
)
|
||||
|
||||
func NewOauthService() {
|
||||
if !setting.Cfg.Section("oauth").Key("ENABLED").MustBool() {
|
||||
return
|
||||
}
|
||||
|
||||
oauth2.AppSubUrl = setting.AppSubUrl
|
||||
|
||||
setting.OauthService = &setting.Oauther{}
|
||||
setting.OauthService.OauthInfos = make(map[string]*setting.OauthInfo)
|
||||
|
||||
socialConfigs := make(map[string]*oauth2.Options)
|
||||
allOauthes := []string{"github", "google", "qq", "twitter", "weibo"}
|
||||
// Load all OAuth config data.
|
||||
for _, name := range allOauthes {
|
||||
sec := setting.Cfg.Section("oauth." + name)
|
||||
if !sec.Key("ENABLED").MustBool() {
|
||||
continue
|
||||
}
|
||||
setting.OauthService.OauthInfos[name] = &setting.OauthInfo{
|
||||
Options: oauth2.Options{
|
||||
ClientID: sec.Key("CLIENT_ID").String(),
|
||||
ClientSecret: sec.Key("CLIENT_SECRET").String(),
|
||||
Scopes: sec.Key("SCOPES").Strings(" "),
|
||||
PathLogin: "/user/login/oauth2/" + name,
|
||||
PathCallback: setting.AppSubUrl + "/user/login/" + name,
|
||||
RedirectURL: setting.AppUrl + "user/login/" + name,
|
||||
},
|
||||
AuthUrl: sec.Key("AUTH_URL").String(),
|
||||
TokenUrl: sec.Key("TOKEN_URL").String(),
|
||||
}
|
||||
socialConfigs[name] = &oauth2.Options{
|
||||
ClientID: setting.OauthService.OauthInfos[name].ClientID,
|
||||
ClientSecret: setting.OauthService.OauthInfos[name].ClientSecret,
|
||||
Scopes: setting.OauthService.OauthInfos[name].Scopes,
|
||||
}
|
||||
}
|
||||
enabledOauths := make([]string, 0, 10)
|
||||
|
||||
// GitHub.
|
||||
if setting.Cfg.Section("oauth.github").Key("ENABLED").MustBool() {
|
||||
setting.OauthService.GitHub = true
|
||||
newGitHubOauth(socialConfigs["github"])
|
||||
enabledOauths = append(enabledOauths, "GitHub")
|
||||
}
|
||||
|
||||
// Google.
|
||||
if setting.Cfg.Section("oauth.google").Key("ENABLED").MustBool() {
|
||||
setting.OauthService.Google = true
|
||||
newGoogleOauth(socialConfigs["google"])
|
||||
enabledOauths = append(enabledOauths, "Google")
|
||||
}
|
||||
|
||||
// QQ.
|
||||
if setting.Cfg.Section("oauth.qq").Key("ENABLED").MustBool() {
|
||||
setting.OauthService.Tencent = true
|
||||
newTencentOauth(socialConfigs["qq"])
|
||||
enabledOauths = append(enabledOauths, "QQ")
|
||||
}
|
||||
|
||||
// Twitter.
|
||||
// if setting.Cfg.Section("oauth.twitter").Key( "ENABLED").MustBool() {
|
||||
// setting.OauthService.Twitter = true
|
||||
// newTwitterOauth(socialConfigs["twitter"])
|
||||
// enabledOauths = append(enabledOauths, "Twitter")
|
||||
// }
|
||||
|
||||
// Weibo.
|
||||
if setting.Cfg.Section("oauth.weibo").Key("ENABLED").MustBool() {
|
||||
setting.OauthService.Weibo = true
|
||||
newWeiboOauth(socialConfigs["weibo"])
|
||||
enabledOauths = append(enabledOauths, "Weibo")
|
||||
}
|
||||
|
||||
log.Info("Oauth Service Enabled %s", enabledOauths)
|
||||
}
|
||||
|
||||
// ________.__ __ ___ ___ ___.
|
||||
// / _____/|__|/ |_ / | \ __ _\_ |__
|
||||
// / \ ___| \ __\/ ~ \ | \ __ \
|
||||
// \ \_\ \ || | \ Y / | / \_\ \
|
||||
// \______ /__||__| \___|_ /|____/|___ /
|
||||
// \/ \/ \/
|
||||
|
||||
type SocialGithub struct {
|
||||
opts *oauth2.Options
|
||||
}
|
||||
|
||||
func newGitHubOauth(opts *oauth2.Options) {
|
||||
SocialMap["github"] = &SocialGithub{opts}
|
||||
}
|
||||
|
||||
func (s *SocialGithub) Type() int {
|
||||
return int(models.GITHUB)
|
||||
}
|
||||
|
||||
func (s *SocialGithub) UserInfo(token *oauth2.Token, _ *url.URL) (*BasicUserInfo, error) {
|
||||
transport := s.opts.NewTransportFromToken(token)
|
||||
var data struct {
|
||||
Id int `json:"id"`
|
||||
Name string `json:"login"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
r, err := transport.Client().Get("https://api.github.com/user")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
if err = json.NewDecoder(r.Body).Decode(&data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &BasicUserInfo{
|
||||
Identity: strconv.Itoa(data.Id),
|
||||
Name: data.Name,
|
||||
Email: data.Email,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ________ .__
|
||||
// / _____/ ____ ____ ____ | | ____
|
||||
// / \ ___ / _ \ / _ \ / ___\| | _/ __ \
|
||||
// \ \_\ ( <_> | <_> ) /_/ > |_\ ___/
|
||||
// \______ /\____/ \____/\___ /|____/\___ >
|
||||
// \/ /_____/ \/
|
||||
|
||||
type SocialGoogle struct {
|
||||
opts *oauth2.Options
|
||||
}
|
||||
|
||||
func (s *SocialGoogle) Type() int {
|
||||
return int(models.GOOGLE)
|
||||
}
|
||||
|
||||
func newGoogleOauth(opts *oauth2.Options) {
|
||||
SocialMap["google"] = &SocialGoogle{opts}
|
||||
}
|
||||
|
||||
func (s *SocialGoogle) UserInfo(token *oauth2.Token, _ *url.URL) (*BasicUserInfo, error) {
|
||||
transport := s.opts.NewTransportFromToken(token)
|
||||
var data struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
r, err := transport.Client().Get("https://www.googleapis.com/userinfo/v2/me")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
if err = json.NewDecoder(r.Body).Decode(&data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &BasicUserInfo{
|
||||
Identity: data.Id,
|
||||
Name: data.Name,
|
||||
Email: data.Email,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ________ ________
|
||||
// \_____ \ \_____ \
|
||||
// / / \ \ / / \ \
|
||||
// / \_/. \/ \_/. \
|
||||
// \_____\ \_/\_____\ \_/
|
||||
// \__> \__>
|
||||
|
||||
type SocialTencent struct {
|
||||
opts *oauth2.Options
|
||||
}
|
||||
|
||||
func newTencentOauth(opts *oauth2.Options) {
|
||||
SocialMap["qq"] = &SocialTencent{opts}
|
||||
}
|
||||
|
||||
func (s *SocialTencent) Type() int {
|
||||
return int(models.QQ)
|
||||
}
|
||||
|
||||
func (s *SocialTencent) UserInfo(token *oauth2.Token, URL *url.URL) (*BasicUserInfo, error) {
|
||||
r, err := http.Get("https://graph.z.qq.com/moc2/me?access_token=" + url.QueryEscape(token.AccessToken))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vals, err := url.ParseQuery(string(body))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &BasicUserInfo{
|
||||
Identity: vals.Get("openid"),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ___________ .__ __ __
|
||||
// \__ ___/_ _ _|__|/ |__/ |_ ___________
|
||||
// | | \ \/ \/ / \ __\ __\/ __ \_ __ \
|
||||
// | | \ /| || | | | \ ___/| | \/
|
||||
// |____| \/\_/ |__||__| |__| \___ >__|
|
||||
// \/
|
||||
|
||||
// type SocialTwitter struct {
|
||||
// Token *oauth2.Token
|
||||
// *oauth2.Transport
|
||||
// }
|
||||
|
||||
// func (s *SocialTwitter) Type() int {
|
||||
// return int(models.TWITTER)
|
||||
// }
|
||||
|
||||
// func newTwitterOauth(config *oauth2.Config) {
|
||||
// SocialMap["twitter"] = &SocialTwitter{
|
||||
// Transport: &oauth.Transport{
|
||||
// Config: config,
|
||||
// Transport: http.DefaultTransport,
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
// func (s *SocialTwitter) SetRedirectUrl(url string) {
|
||||
// s.Transport.Config.RedirectURL = url
|
||||
// }
|
||||
|
||||
// //https://github.com/mrjones/oauth
|
||||
// func (s *SocialTwitter) UserInfo(token *oauth2.Token, _ *url.URL) (*BasicUserInfo, error) {
|
||||
// // transport := &oauth.Transport{Token: token}
|
||||
// // var data struct {
|
||||
// // Id string `json:"id"`
|
||||
// // Name string `json:"name"`
|
||||
// // Email string `json:"email"`
|
||||
// // }
|
||||
// // var err error
|
||||
|
||||
// // reqUrl := "https://www.googleapis.com/oauth2/v1/userinfo"
|
||||
// // r, err := transport.Client().Get(reqUrl)
|
||||
// // if err != nil {
|
||||
// // return nil, err
|
||||
// // }
|
||||
// // defer r.Body.Close()
|
||||
// // if err = json.NewDecoder(r.Body).Decode(&data); err != nil {
|
||||
// // return nil, err
|
||||
// // }
|
||||
// // return &BasicUserInfo{
|
||||
// // Identity: data.Id,
|
||||
// // Name: data.Name,
|
||||
// // Email: data.Email,
|
||||
// // }, nil
|
||||
// return nil, nil
|
||||
// }
|
||||
|
||||
// __ __ ._____.
|
||||
// / \ / \ ____ |__\_ |__ ____
|
||||
// \ \/\/ // __ \| || __ \ / _ \
|
||||
// \ /\ ___/| || \_\ ( <_> )
|
||||
// \__/\ / \___ >__||___ /\____/
|
||||
// \/ \/ \/
|
||||
|
||||
type SocialWeibo struct {
|
||||
opts *oauth2.Options
|
||||
}
|
||||
|
||||
func newWeiboOauth(opts *oauth2.Options) {
|
||||
SocialMap["weibo"] = &SocialWeibo{opts}
|
||||
}
|
||||
|
||||
func (s *SocialWeibo) Type() int {
|
||||
return int(models.WEIBO)
|
||||
}
|
||||
|
||||
func (s *SocialWeibo) UserInfo(token *oauth2.Token, _ *url.URL) (*BasicUserInfo, error) {
|
||||
transport := s.opts.NewTransportFromToken(token)
|
||||
var data struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
var urls = url.Values{
|
||||
"access_token": {token.AccessToken},
|
||||
"uid": {token.Extra("uid")},
|
||||
}
|
||||
reqUrl := "https://api.weibo.com/2/users/show.json"
|
||||
r, err := transport.Client().Get(reqUrl + "?" + urls.Encode())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
if err = json.NewDecoder(r.Body).Decode(&data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &BasicUserInfo{
|
||||
Identity: token.Extra("uid"),
|
||||
Name: data.Name,
|
||||
}, nil
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
// "strings"
|
||||
"time"
|
||||
|
||||
"github.com/macaron-contrib/oauth2"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
"github.com/gogits/gogs/modules/social"
|
||||
)
|
||||
|
||||
func SocialSignIn(ctx *middleware.Context) {
|
||||
if setting.OauthService == nil {
|
||||
ctx.Handle(404, "OAuth2 service not enabled", nil)
|
||||
return
|
||||
}
|
||||
|
||||
next := setting.AppSubUrl + "/user/login"
|
||||
info := ctx.Session.Get(oauth2.KEY_TOKEN)
|
||||
if info == nil {
|
||||
ctx.Redirect(next)
|
||||
return
|
||||
}
|
||||
|
||||
name := ctx.Params(":name")
|
||||
connect, ok := social.SocialMap[name]
|
||||
if !ok {
|
||||
ctx.Handle(404, "social login not enabled", errors.New(name))
|
||||
return
|
||||
}
|
||||
|
||||
tk := new(oauth2.Token)
|
||||
if err := json.Unmarshal(info.([]byte), tk); err != nil {
|
||||
ctx.Handle(500, "Unmarshal token", err)
|
||||
return
|
||||
}
|
||||
|
||||
ui, err := connect.UserInfo(tk, ctx.Req.URL)
|
||||
if err != nil {
|
||||
ctx.Handle(500, fmt.Sprintf("UserInfo(%s)", name), err)
|
||||
return
|
||||
}
|
||||
if len(ui.Identity) == 0 {
|
||||
ctx.Handle(404, "no identity is presented", errors.New(name))
|
||||
return
|
||||
}
|
||||
log.Info("social.SocialSignIn(social login): %s", ui)
|
||||
|
||||
oa, err := models.GetOauth2(ui.Identity)
|
||||
switch err {
|
||||
case nil:
|
||||
ctx.Session.Set("uid", oa.User.Id)
|
||||
ctx.Session.Set("uname", oa.User.Name)
|
||||
case models.ErrOauth2RecordNotExist:
|
||||
raw, _ := json.Marshal(tk)
|
||||
oa = &models.Oauth2{
|
||||
Uid: -1,
|
||||
Type: connect.Type(),
|
||||
Identity: ui.Identity,
|
||||
Token: string(raw),
|
||||
}
|
||||
log.Trace("social.SocialSignIn(oa): %v", oa)
|
||||
if err = models.AddOauth2(oa); err != nil {
|
||||
log.Error(4, "social.SocialSignIn(add oauth2): %v", err) // 501
|
||||
return
|
||||
}
|
||||
case models.ErrOauth2NotAssociated:
|
||||
next = setting.AppSubUrl + "/user/sign_up"
|
||||
default:
|
||||
ctx.Handle(500, "social.SocialSignIn(GetOauth2)", err)
|
||||
return
|
||||
}
|
||||
|
||||
oa.Updated = time.Now()
|
||||
if err = models.UpdateOauth2(oa); err != nil {
|
||||
log.Error(4, "UpdateOauth2: %v", err)
|
||||
}
|
||||
|
||||
ctx.Session.Set("socialId", oa.Id)
|
||||
ctx.Session.Set("socialName", ui.Name)
|
||||
ctx.Session.Set("socialEmail", ui.Email)
|
||||
log.Trace("social.SocialSignIn(social ID): %v", oa.Id)
|
||||
ctx.Redirect(next)
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{{if .OauthService.GitHub}}<a class="btn github" href="{{AppSubUrl}}/user/login/oauth2/github?next={{AppSubUrl}}/user/info/github"><i class="fa fa-github"></i>GitHub</a>{{end}}
|
||||
{{if .OauthService.Google}}<a class="btn google" href="{{AppSubUrl}}/user/login/oauth2/google?next={{AppSubUrl}}/user/info/google"><i class="fa fa-google"></i>Google +</a>{{end}}
|
||||
{{if .OauthService.Weibo}}<a class="btn weibo" href="{{AppSubUrl}}/user/login/oauth2/weibo?next={{AppSubUrl}}/user/info/weibo"><i class="fa fa-weibo"></i>新浪微博</a>{{end}}
|
||||
{{if .OauthService.Tencent}}<a class="btn qq" href="{{AppSubUrl}}/user/login/oauth2/qq?next={{AppSubUrl}}/user/info/qq"><i class="fa fa-qq"></i>腾讯 QQ </a>{{end}}
|
@ -1,16 +0,0 @@
|
||||
<div id="setting-menu" class="grid-1-5 panel panel-radius left">
|
||||
<p class="panel-header"><strong>{{.i18n.Tr "settings"}}</strong></p>
|
||||
<div class="panel-body">
|
||||
<ul class="menu menu-vertical switching-list grid-1-5 left">
|
||||
<li {{if .PageIsSettingsProfile}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings">{{.i18n.Tr "settings.profile"}}</a></li>
|
||||
<li {{if .PageIsSettingsPassword}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/password">{{.i18n.Tr "settings.password"}}</a></li>
|
||||
<li {{if .PageIsSettingsEmails}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/email">{{.i18n.Tr "settings.emails"}}</a></li>
|
||||
<li {{if .PageIsSettingsSSHKeys}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/ssh">{{.i18n.Tr "settings.ssh_keys"}}</a></li>
|
||||
{{if .HasOAuthService}}
|
||||
<li {{if .PageIsSettingsSocial}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/social">{{.i18n.Tr "settings.social"}}</a></li>
|
||||
{{end}}
|
||||
<li {{if .PageIsSettingsApplications}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/applications">{{.i18n.Tr "settings.applications"}}</a></li>
|
||||
<li {{if .PageIsSettingsDelete}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/delete">{{.i18n.Tr "settings.delete"}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@ -1,33 +0,0 @@
|
||||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="setting-wrapper" class="main-wrapper">
|
||||
<div id="user-profile-setting" class="container clear">
|
||||
{{template "user/settings/nav" .}}
|
||||
<div class="grid-4-5 left">
|
||||
<div class="setting-content">
|
||||
{{template "ng/base/alert" .}}
|
||||
<div id="setting-content">
|
||||
<div id="user-social-panel" class="panel panel-radius">
|
||||
<div class="panel-header"><strong>{{.i18n.Tr "settings.manage_social"}}</strong></div>
|
||||
<ul class="panel-body setting-list">
|
||||
<li>{{.i18n.Tr "settings.social_desc"}}</li>
|
||||
{{range .Socials}}
|
||||
<li class="ssh clear">
|
||||
<span class="active-icon left label label-{{if .HasRecentActivity}}green{{else}}gray{{end}} label-radius"></span>
|
||||
<i class="fa {{Oauth2Icon .Type}} fa-2x left"></i>
|
||||
<div class="ssh-content left">
|
||||
<p><strong>{{Oauth2Name .Type}}</strong></p>
|
||||
<p class="print">{{.Identity}}</p>
|
||||
<p class="activity"><i>{{$.i18n.Tr "settings.add_on"}} <span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i>{{$.i18n.Tr "settings.last_used"}} {{DateFmtShort .Updated}}</i></p>
|
||||
</div>
|
||||
<a class="right btn btn-small btn-red btn-header btn-radius" href="{{AppSubUrl}}/user/settings/social?remove={{.Id}}">{{$.i18n.Tr "settings.unbind"}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
Loading…
Reference in New Issue