#5443 修复bug

Merged
chenyifan01 merged 4 commits from efficient_signup into V20240423.patch 2 weeks ago
  1. +0
    -21
      models/user.go
  2. +1
    -0
      options/locale/locale_en-US.ini
  3. +1
    -0
      options/locale/locale_zh-CN.ini
  4. +1
    -1
      routers/routes/routes.go
  5. +5
    -12
      routers/user/auth.go
  6. +1
    -0
      services/wechat_service/event_handle.go
  7. +2
    -1
      templates/user/settings/profile.tmpl
  8. +6
    -6
      web_src/vuepages/pages/repos/components/ReposItem.vue
  9. +1
    -1
      web_src/vuepages/pages/repos/components/ReposList.vue
  10. +1
    -1
      web_src/vuepages/pages/ros-hmci/components/ReposList.vue

+ 0
- 21
models/user.go View File

@@ -1087,28 +1087,7 @@ func CreateUser(u *User) (err error) {
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.AvatarEmail = u.Email
//u.Avatar = base.HashEmail(u.AvatarEmail)
if u.Rands, err = GetUserSalt(); err != nil {
return err
}


+ 1
- 0
options/locale/locale_en-US.ini View File

@@ -671,6 +671,7 @@ bind_account_information = Bind account information
bind_time = Bind Time
wechat = Wechat
unbind_wc = Unbind
modify_bind_wc = Modify WeChat binding
unbind_wechat = Are you sure you want to unbind WeChat?
unbind_computing = After unbundling, the qizhi computing power environment will not be available



+ 1
- 0
options/locale/locale_zh-CN.ini View File

@@ -675,6 +675,7 @@ bind_account_information = 绑定账号信息
bind_time = 绑定时间
wechat = 微信
unbind_wc = 解除绑定
modify_bind_wc = 修改绑定微信
unbind_wechat = 确定要解绑微信?
unbind_computing = 解绑后将无法使用启智算力环境



+ 1
- 1
routers/routes/routes.go View File

@@ -551,7 +551,7 @@ func RegisterRoutes(m *macaron.Macaron) {

m.Group("/authentication/wechat", func() {
m.Get("/qrCode4Bind", authentication.GetQRCode4Bind)
m.Post("/unbind", authentication.UnbindWechat)
//m.Post("/unbind", authentication.UnbindWechat)
m.Get("/bind", authentication.GetBindPage)
}, reqSignIn)
m.Get("/authentication/wechat/bindStatus", authentication.GetBindStatus)


+ 5
- 12
routers/user/auth.go View File

@@ -6,6 +6,7 @@
package user

import (
"code.gitea.io/gitea/modules/notification"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@@ -1813,6 +1814,10 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
}
return
}

if setting.WechatSignUpRequired {
go notification.NotifyWechatBind(u, wechatOpenId)
}
log.Trace("Account created: %s", u.Name, ctx.Data["MsgID"])

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.
if models.CountUsers() == 1 {
u.IsAdmin = true


+ 1
- 0
services/wechat_service/event_handle.go View File

@@ -178,6 +178,7 @@ func HandleScanEvent(we WechatMsg) string {
needNotify = true
err := wechat.BindWechat(qrCache.UserId, we.FromUserName)
if err != nil {
redis_client.Del(key)
if err, ok := err.(models.WechatBindError); ok {
return err.Reply
}


+ 2
- 1
templates/user/settings/profile.tmpl View File

@@ -147,7 +147,8 @@
{{TimeSinceUnix1 .SignedUser.WechatBindUnix}}
<td class="center aligned">
<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>
</td>
</tbody>


+ 6
- 6
web_src/vuepages/pages/repos/components/ReposItem.vue View File

@@ -12,15 +12,15 @@
<span class="title-1"> / </span>
<span class="title-2" v-html="data.NameShow"></span>
</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">
<use xlink:href="#octicon-repo-forked"></use>
</svg>
<svg v-if="data.IsMirror" class="svg octicon-repo-clone" width="15" height="15" aria-hidden="true">
<use xlink:href="#octicon-repo-clone"></use>
</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>
</svg>
</div>
@@ -79,11 +79,11 @@
{{ $t('repos.contributors') }}&nbsp;
</span>
<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">
<span class="avatar" v-show="!item.UserName" :style="{ backgroundColor: item.bgColor }">
{{ item.Email[0].toLocaleUpperCase() }}</span>
{{ (item.Email[0] || '').toLocaleUpperCase() }}</span>
</a>
</span>
</div>


+ 1
- 1
web_src/vuepages/pages/repos/components/ReposList.vue View File

@@ -59,7 +59,7 @@ export default {
item.Contributors = (item.Contributors || []).map((_item) => {
return {
..._item,
bgColor: this.randomColor(_item.Email[0].toLocaleUpperCase()),
bgColor: this.randomColor((_item.Email[0] || '').toLocaleUpperCase()),
}
});
const contributors = item.Contributors || [];


+ 1
- 1
web_src/vuepages/pages/ros-hmci/components/ReposList.vue View File

@@ -62,7 +62,7 @@ export default {
item.Contributors = (item.Contributors || []).map((_item) => {
return {
..._item,
bgColor: this.randomColor(_item.Email[0].toLocaleUpperCase()),
bgColor: this.randomColor((_item.Email[0] || '').toLocaleUpperCase()),
};
});
const contributors = item.Contributors || [];


Loading…
Cancel
Save