efficient_signup
into V20240423.patch
4 weeks ago
@@ -1087,28 +1087,7 @@ func CreateUser(u *User) (err error) { | |||||
return ErrUserAlreadyExist{u.Name} | return ErrUserAlreadyExist{u.Name} | ||||
} | } | ||||
//u.Email = strings.ToLower(u.Email) | |||||
//isExist, err = sess. | |||||
// Where("email=?", u.Email). | |||||
// Get(new(User)) | |||||
//if err != nil { | |||||
// return err | |||||
//} else if isExist { | |||||
// return ErrEmailAlreadyUsed{u.Email} | |||||
//} | |||||
// | |||||
//isExist, err = isEmailUsed(sess, u.Email) | |||||
//if err != nil { | |||||
// return err | |||||
//} else if isExist { | |||||
// return ErrEmailAlreadyUsed{u.Email} | |||||
//} | |||||
//u.KeepEmailPrivate = setting.Service.DefaultKeepEmailPrivate | |||||
u.LowerName = strings.ToLower(u.Name) | u.LowerName = strings.ToLower(u.Name) | ||||
//u.AvatarEmail = u.Email | |||||
//u.Avatar = base.HashEmail(u.AvatarEmail) | |||||
if u.Rands, err = GetUserSalt(); err != nil { | if u.Rands, err = GetUserSalt(); err != nil { | ||||
return err | return err | ||||
} | } | ||||
@@ -671,6 +671,7 @@ bind_account_information = Bind account information | |||||
bind_time = Bind Time | bind_time = Bind Time | ||||
wechat = Wechat | wechat = Wechat | ||||
unbind_wc = Unbind | unbind_wc = Unbind | ||||
modify_bind_wc = Modify WeChat binding | |||||
unbind_wechat = Are you sure you want to unbind WeChat? | unbind_wechat = Are you sure you want to unbind WeChat? | ||||
unbind_computing = After unbundling, the qizhi computing power environment will not be available | unbind_computing = After unbundling, the qizhi computing power environment will not be available | ||||
@@ -675,6 +675,7 @@ bind_account_information = 绑定账号信息 | |||||
bind_time = 绑定时间 | bind_time = 绑定时间 | ||||
wechat = 微信 | wechat = 微信 | ||||
unbind_wc = 解除绑定 | unbind_wc = 解除绑定 | ||||
modify_bind_wc = 修改绑定微信 | |||||
unbind_wechat = 确定要解绑微信? | unbind_wechat = 确定要解绑微信? | ||||
unbind_computing = 解绑后将无法使用启智算力环境 | unbind_computing = 解绑后将无法使用启智算力环境 | ||||
@@ -551,7 +551,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
m.Group("/authentication/wechat", func() { | m.Group("/authentication/wechat", func() { | ||||
m.Get("/qrCode4Bind", authentication.GetQRCode4Bind) | m.Get("/qrCode4Bind", authentication.GetQRCode4Bind) | ||||
m.Post("/unbind", authentication.UnbindWechat) | |||||
//m.Post("/unbind", authentication.UnbindWechat) | |||||
m.Get("/bind", authentication.GetBindPage) | m.Get("/bind", authentication.GetBindPage) | ||||
}, reqSignIn) | }, reqSignIn) | ||||
m.Get("/authentication/wechat/bindStatus", authentication.GetBindStatus) | m.Get("/authentication/wechat/bindStatus", authentication.GetBindStatus) | ||||
@@ -6,6 +6,7 @@ | |||||
package user | package user | ||||
import ( | import ( | ||||
"code.gitea.io/gitea/modules/notification" | |||||
"crypto/rand" | "crypto/rand" | ||||
"crypto/rsa" | "crypto/rsa" | ||||
"crypto/x509" | "crypto/x509" | ||||
@@ -1813,6 +1814,10 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo | |||||
} | } | ||||
return | return | ||||
} | } | ||||
if setting.WechatSignUpRequired { | |||||
go notification.NotifyWechatBind(u, wechatOpenId) | |||||
} | |||||
log.Trace("Account created: %s", u.Name, ctx.Data["MsgID"]) | log.Trace("Account created: %s", u.Name, ctx.Data["MsgID"]) | ||||
log.Info("enter here, and form.InvitaionCode =" + invitationCode) | log.Info("enter here, and form.InvitaionCode =" + invitationCode) | ||||
@@ -1823,18 +1828,6 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo | |||||
} | } | ||||
} | } | ||||
//err := models.AddEmailAddress(&models.EmailAddress{ | |||||
// UID: u.ID, | |||||
// Email: form.Email, | |||||
// IsActivated: !setting.Service.RegisterEmailConfirm, | |||||
//}) | |||||
//if err != nil { | |||||
// log.Error("AddEmailAddress failed:%v", err.Error(), ctx.Data["MsgID"]) | |||||
// ctx.ServerError("AddEmailAddress", err) | |||||
// return | |||||
//} | |||||
// Auto-set admin for the only user. | // Auto-set admin for the only user. | ||||
if models.CountUsers() == 1 { | if models.CountUsers() == 1 { | ||||
u.IsAdmin = true | u.IsAdmin = true | ||||
@@ -178,6 +178,7 @@ func HandleScanEvent(we WechatMsg) string { | |||||
needNotify = true | needNotify = true | ||||
err := wechat.BindWechat(qrCache.UserId, we.FromUserName) | err := wechat.BindWechat(qrCache.UserId, we.FromUserName) | ||||
if err != nil { | if err != nil { | ||||
redis_client.Del(key) | |||||
if err, ok := err.(models.WechatBindError); ok { | if err, ok := err.(models.WechatBindError); ok { | ||||
return err.Reply | return err.Reply | ||||
} | } | ||||
@@ -147,7 +147,8 @@ | |||||
{{TimeSinceUnix1 .SignedUser.WechatBindUnix}} | {{TimeSinceUnix1 .SignedUser.WechatBindUnix}} | ||||
<td class="center aligned"> | <td class="center aligned"> | ||||
<div> | <div> | ||||
<a class="ui inverted orange button " onclick="showcreate(this)" href="javascript: void(0)">{{$.i18n.Tr "settings.unbind_wc"}}</a> | |||||
<!--<a class="ui inverted orange button " onclick="showcreate(this)" href="javascript: void(0)">{{$.i18n.Tr "settings.unbind_wc"}}</a>--> | |||||
<a href="/authentication/wechat/bind?type=modify&redirect_to=/user/settings" class="ui green button">{{$.i18n.Tr "settings.modify_bind_wc"}}</a> | |||||
</div> | </div> | ||||
</td> | </td> | ||||
</tbody> | </tbody> | ||||
@@ -12,15 +12,15 @@ | |||||
<span class="title-1"> / </span> | <span class="title-1"> / </span> | ||||
<span class="title-2" v-html="data.NameShow"></span> | <span class="title-2" v-html="data.NameShow"></span> | ||||
</a> | </a> | ||||
<i v-if="data.IsArchived" class="archive icon archived-icon"></i> | |||||
<i v-if="data.IsArchived" class="archive icon archived-icon"></i> | |||||
<svg v-if="data.IsFork" class="svg octicon-repo-forked" width="15" height="15" aria-hidden="true"> | <svg v-if="data.IsFork" class="svg octicon-repo-forked" width="15" height="15" aria-hidden="true"> | ||||
<use xlink:href="#octicon-repo-forked"></use> | <use xlink:href="#octicon-repo-forked"></use> | ||||
</svg> | </svg> | ||||
<svg v-if="data.IsMirror" class="svg octicon-repo-clone" width="15" height="15" aria-hidden="true"> | <svg v-if="data.IsMirror" class="svg octicon-repo-clone" width="15" height="15" aria-hidden="true"> | ||||
<use xlink:href="#octicon-repo-clone"></use> | <use xlink:href="#octicon-repo-clone"></use> | ||||
</svg> | </svg> | ||||
<svg v-if="(data.IsPrivate || data.IsOwnerPrivate)" style="color:#a1882b!important" class="svg octicon-lock" width="15" height="15" | |||||
aria-hidden="true"> | |||||
<svg v-if="(data.IsPrivate || data.IsOwnerPrivate)" style="color:#a1882b!important" | |||||
class="svg octicon-lock" width="15" height="15" aria-hidden="true"> | |||||
<use xlink:href="#octicon-lock"></use> | <use xlink:href="#octicon-lock"></use> | ||||
</svg> | </svg> | ||||
</div> | </div> | ||||
@@ -79,11 +79,11 @@ | |||||
{{ $t('repos.contributors') }} | {{ $t('repos.contributors') }} | ||||
</span> | </span> | ||||
<span class="contributors-avatar"> | <span class="contributors-avatar"> | ||||
<a :href="item.UserName ? `/${item.UserName}` : `mailto:${item.Email}`" class="avatar-c" | |||||
v-for="(item, index) in data.Contributors" :key="index"> | |||||
<a :href="item.UserName ? `/${item.UserName}` : (item.Email ? `mailto:${item.Email}` : 'javascript:;')" | |||||
class="avatar-c" v-for="(item, index) in data.Contributors" :key="index"> | |||||
<img class="avatar" v-show="item.UserName" :src="item.RelAvatarLink"> | <img class="avatar" v-show="item.UserName" :src="item.RelAvatarLink"> | ||||
<span class="avatar" v-show="!item.UserName" :style="{ backgroundColor: item.bgColor }"> | <span class="avatar" v-show="!item.UserName" :style="{ backgroundColor: item.bgColor }"> | ||||
{{ item.Email[0].toLocaleUpperCase() }}</span> | |||||
{{ (item.Email[0] || '').toLocaleUpperCase() }}</span> | |||||
</a> | </a> | ||||
</span> | </span> | ||||
</div> | </div> | ||||
@@ -59,7 +59,7 @@ export default { | |||||
item.Contributors = (item.Contributors || []).map((_item) => { | item.Contributors = (item.Contributors || []).map((_item) => { | ||||
return { | return { | ||||
..._item, | ..._item, | ||||
bgColor: this.randomColor(_item.Email[0].toLocaleUpperCase()), | |||||
bgColor: this.randomColor((_item.Email[0] || '').toLocaleUpperCase()), | |||||
} | } | ||||
}); | }); | ||||
const contributors = item.Contributors || []; | const contributors = item.Contributors || []; | ||||
@@ -62,7 +62,7 @@ export default { | |||||
item.Contributors = (item.Contributors || []).map((_item) => { | item.Contributors = (item.Contributors || []).map((_item) => { | ||||
return { | return { | ||||
..._item, | ..._item, | ||||
bgColor: this.randomColor(_item.Email[0].toLocaleUpperCase()), | |||||
bgColor: this.randomColor((_item.Email[0] || '').toLocaleUpperCase()), | |||||
}; | }; | ||||
}); | }); | ||||
const contributors = item.Contributors || []; | const contributors = item.Contributors || []; | ||||
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》