diff --git a/models/user_mail.go b/models/user_mail.go
index 7244ec378..8bf74b81b 100755
--- a/models/user_mail.go
+++ b/models/user_mail.go
@@ -293,6 +293,16 @@ func MakeEmailPrimary(email *EmailAddress) error {
}
user.Email = email.Email
+
+ has, err = sess.Where("id!=?", user.ID).
+ And("type=?", user.Type).
+ And("email=?", strings.ToLower(user.Email)).
+ Get(new(User))
+ if err != nil {
+ return err
+ } else if has {
+ return ErrEmailAlreadyUsed{user.Email}
+ }
if _, err = sess.ID(user.ID).Cols("email").Update(user); err != nil {
return err
}
diff --git a/public/img/apple-touch-icon.png b/public/img/apple-touch-icon.png
index ec276009b..4623f8c3e 100644
Binary files a/public/img/apple-touch-icon.png and b/public/img/apple-touch-icon.png differ
diff --git a/public/img/avatar_default.png b/public/img/avatar_default.png
index 94a3900d4..60e434568 100644
Binary files a/public/img/avatar_default.png and b/public/img/avatar_default.png differ
diff --git a/public/img/favicon.png b/public/img/favicon.png
index 179324343..b660aa165 100644
Binary files a/public/img/favicon.png and b/public/img/favicon.png differ
diff --git a/public/img/gitea-192.png b/public/img/gitea-192.png
index 136d7f954..d8cc42031 100644
Binary files a/public/img/gitea-192.png and b/public/img/gitea-192.png differ
diff --git a/public/img/gitea-512.png b/public/img/gitea-512.png
index ee151a280..7db1cac09 100644
Binary files a/public/img/gitea-512.png and b/public/img/gitea-512.png differ
diff --git a/public/img/gitea-lg.png b/public/img/gitea-lg.png
index f046587a8..0d5178bcb 100644
Binary files a/public/img/gitea-lg.png and b/public/img/gitea-lg.png differ
diff --git a/public/img/gitea-safari.svg b/public/img/gitea-safari.svg
index cc0e7c73f..73e3ee6b4 100644
--- a/public/img/gitea-safari.svg
+++ b/public/img/gitea-safari.svg
@@ -1 +1,17 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/public/img/gitea-sm.png b/public/img/gitea-sm.png
index a303865af..3f6d3f276 100644
Binary files a/public/img/gitea-sm.png and b/public/img/gitea-sm.png differ
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 4138e702f..2e5e3d2e3 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -1,8 +1,10 @@
package repo
import (
+ "bufio"
"encoding/json"
"errors"
+ "io"
"net/http"
"os"
"os/exec"
@@ -499,6 +501,45 @@ func downloadCode(repo *models.Repository, codePath string) error {
return err
}
+ configFile, err := os.OpenFile(codePath + "/.git/config", os.O_RDWR, 0666)
+ if err != nil {
+ log.Error("open file(%s) failed:%v", codePath + "/,git/config", err)
+ return err
+ }
+
+ defer configFile.Close()
+
+ pos := int64(0)
+ reader := bufio.NewReader(configFile)
+ for {
+ line, err := reader.ReadString('\n')
+ if err != nil {
+ if err == io.EOF {
+ log.Error("not find the remote-url")
+ return nil
+ } else {
+ log.Error("read error: %v", err)
+ return err
+ }
+ }
+
+ if strings.Contains(line, "url") && strings.Contains(line, ".git"){
+ originUrl := "\turl = " + repo.CloneLink().HTTPS + "\n"
+ if len(line) > len(originUrl) {
+ originUrl += strings.Repeat( " ", len(line) - len(originUrl))
+ }
+ bytes := []byte(originUrl)
+ _, err := configFile.WriteAt(bytes, pos)
+ if err != nil {
+ log.Error("WriteAt failed:%v", err)
+ return err
+ }
+ break
+ }
+
+ pos += int64(len(line))
+ }
+
return nil
}
diff --git a/routers/user/setting/account.go b/routers/user/setting/account.go
index 27f0bf1c8..6165bfc5b 100644
--- a/routers/user/setting/account.go
+++ b/routers/user/setting/account.go
@@ -80,6 +80,12 @@ func EmailPost(ctx *context.Context, form auth.AddEmailForm) {
// Make emailaddress primary.
if ctx.Query("_method") == "PRIMARY" {
if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil {
+ if _, ok := err.(models.ErrEmailAlreadyUsed); ok {
+ ctx.Flash.Error(ctx.Tr("form.email_been_used"))
+ ctx.Redirect(setting.AppSubURL + "/user/settings/account")
+ return
+ }
+
ctx.ServerError("MakeEmailPrimary", err)
return
}