diff --git a/cmd/admin.go b/cmd/admin.go
index 5000fc2d4..5492b9a2d 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -20,9 +20,7 @@ var (
// CmdAdmin represents the available admin sub-command.
CmdAdmin = cli.Command{
Name: "admin",
- Usage: "Perform admin operations on command line",
- Description: `Allow using internal logic of Gitea without hacking into the source code
-to make automatic initialization process more smoothly`,
+ Usage: "Command line interface to perform common administrative operations",
Subcommands: []cli.Command{
subcmdCreateUser,
subcmdChangePassword,
@@ -37,17 +35,14 @@ to make automatic initialization process more smoothly`,
Flags: []cli.Flag{
cli.StringFlag{
Name: "name",
- Value: "",
Usage: "Username",
},
cli.StringFlag{
Name: "password",
- Value: "",
Usage: "User password",
},
cli.StringFlag{
Name: "email",
- Value: "",
Usage: "User email address",
},
cli.BoolFlag{
@@ -88,57 +83,42 @@ to make automatic initialization process more smoothly`,
)
func runChangePassword(c *cli.Context) error {
- if !c.IsSet("password") {
- return fmt.Errorf("Password is not specified")
- } else if !c.IsSet("username") {
- return fmt.Errorf("Username is not specified")
+ if err := argsSet(c, "username", "password"); err != nil {
+ return err
}
- setting.NewContext()
- models.LoadConfigs()
-
- setting.NewXORMLogService(false)
- if err := models.SetEngine(); err != nil {
- return fmt.Errorf("models.SetEngine: %v", err)
+ if err := initDB(); err != nil {
+ return err
}
uname := c.String("username")
user, err := models.GetUserByName(uname)
if err != nil {
- return fmt.Errorf("%v", err)
+ return err
}
- user.Passwd = c.String("password")
if user.Salt, err = models.GetUserSalt(); err != nil {
- return fmt.Errorf("%v", err)
+ return err
}
- user.HashPassword()
+ user.HashPassword(c.String("password"))
if err := models.UpdateUserCols(user, "passwd", "salt"); err != nil {
- return fmt.Errorf("%v", err)
+ return err
}
- fmt.Printf("User '%s' password has been successfully updated!\n", uname)
+ fmt.Printf("%s's password has been successfully updated!\n", user.Name)
return nil
}
func runCreateUser(c *cli.Context) error {
- if !c.IsSet("name") {
- return fmt.Errorf("Username is not specified")
- } else if !c.IsSet("password") {
- return fmt.Errorf("Password is not specified")
- } else if !c.IsSet("email") {
- return fmt.Errorf("Email is not specified")
+ if err := argsSet(c, "name", "password", "email"); err != nil {
+ return err
}
if c.IsSet("config") {
setting.CustomConf = c.String("config")
}
- setting.NewContext()
- models.LoadConfigs()
-
- setting.NewXORMLogService(false)
- if err := models.SetEngine(); err != nil {
- return fmt.Errorf("models.SetEngine: %v", err)
+ if err := initDB(); err != nil {
+ return err
}
if err := models.CreateUser(&models.User{
@@ -156,13 +136,8 @@ func runCreateUser(c *cli.Context) error {
}
func runRepoSyncReleases(c *cli.Context) error {
-
- setting.NewContext()
- models.LoadConfigs()
-
- setting.NewXORMLogService(false)
- if err := models.SetEngine(); err != nil {
- return fmt.Errorf("models.SetEngine: %v", err)
+ if err := initDB(); err != nil {
+ return err
}
log.Trace("Synchronizing repository releases (this may take a while)")
@@ -173,8 +148,7 @@ func runRepoSyncReleases(c *cli.Context) error {
Private: true,
})
if err != nil {
- log.Fatal(4, "SearchRepositoryByName: %v", err)
- return err
+ return fmt.Errorf("SearchRepositoryByName: %v", err)
}
if len(repos) == 0 {
break
@@ -188,11 +162,7 @@ func runRepoSyncReleases(c *cli.Context) error {
continue
}
- oldnum, err := models.GetReleaseCountByRepoID(repo.ID,
- models.FindReleasesOptions{
- IncludeDrafts: false,
- IncludeTags: true,
- })
+ oldnum, err := getReleaseCount(repo.ID)
if err != nil {
log.Warn(" GetReleaseCountByRepoID: %v", err)
}
@@ -203,11 +173,7 @@ func runRepoSyncReleases(c *cli.Context) error {
continue
}
- count, err = models.GetReleaseCountByRepoID(repo.ID,
- models.FindReleasesOptions{
- IncludeDrafts: false,
- IncludeTags: true,
- })
+ count, err = getReleaseCount(repo.ID)
if err != nil {
log.Warn(" GetReleaseCountByRepoID: %v", err)
continue
@@ -220,3 +186,12 @@ func runRepoSyncReleases(c *cli.Context) error {
return nil
}
+
+func getReleaseCount(id int64) (int64, error) {
+ return models.GetReleaseCountByRepoID(
+ id,
+ models.FindReleasesOptions{
+ IncludeTags: true,
+ },
+ )
+}
diff --git a/cmd/cert.go b/cmd/cert.go
index d9e9e366b..46473c004 100644
--- a/cmd/cert.go
+++ b/cmd/cert.go
@@ -90,16 +90,16 @@ func pemBlockForKey(priv interface{}) *pem.Block {
}
}
-func runCert(ctx *cli.Context) error {
- if len(ctx.String("host")) == 0 {
- log.Fatal("Missing required --host parameter")
+func runCert(c *cli.Context) error {
+ if err := argsSet(c, "host"); err != nil {
+ return err
}
var priv interface{}
var err error
- switch ctx.String("ecdsa-curve") {
+ switch c.String("ecdsa-curve") {
case "":
- priv, err = rsa.GenerateKey(rand.Reader, ctx.Int("rsa-bits"))
+ priv, err = rsa.GenerateKey(rand.Reader, c.Int("rsa-bits"))
case "P224":
priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader)
case "P256":
@@ -109,23 +109,23 @@ func runCert(ctx *cli.Context) error {
case "P521":
priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
default:
- log.Fatalf("Unrecognized elliptic curve: %q", ctx.String("ecdsa-curve"))
+ log.Fatalf("Unrecognized elliptic curve: %q", c.String("ecdsa-curve"))
}
if err != nil {
log.Fatalf("Failed to generate private key: %v", err)
}
var notBefore time.Time
- if len(ctx.String("start-date")) == 0 {
- notBefore = time.Now()
- } else {
- notBefore, err = time.Parse("Jan 2 15:04:05 2006", ctx.String("start-date"))
+ if startDate := c.String("start-date"); startDate != "" {
+ notBefore, err = time.Parse("Jan 2 15:04:05 2006", startDate)
if err != nil {
log.Fatalf("Failed to parse creation date: %v", err)
}
+ } else {
+ notBefore = time.Now()
}
- notAfter := notBefore.Add(ctx.Duration("duration"))
+ notAfter := notBefore.Add(c.Duration("duration"))
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
@@ -147,7 +147,7 @@ func runCert(ctx *cli.Context) error {
BasicConstraintsValid: true,
}
- hosts := strings.Split(ctx.String("host"), ",")
+ hosts := strings.Split(c.String("host"), ",")
for _, h := range hosts {
if ip := net.ParseIP(h); ip != nil {
template.IPAddresses = append(template.IPAddresses, ip)
@@ -156,7 +156,7 @@ func runCert(ctx *cli.Context) error {
}
}
- if ctx.Bool("ca") {
+ if c.Bool("ca") {
template.IsCA = true
template.KeyUsage |= x509.KeyUsageCertSign
}
diff --git a/cmd/cmd.go b/cmd/cmd.go
new file mode 100644
index 000000000..15dd08524
--- /dev/null
+++ b/cmd/cmd.go
@@ -0,0 +1,38 @@
+// Copyright 2018 The Gitea 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 cmd provides subcommands to the gitea binary - such as "web" or
+// "admin".
+package cmd
+
+import (
+ "errors"
+ "fmt"
+
+ "code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/setting"
+ "github.com/urfave/cli"
+)
+
+// argsSet checks that all the required arguments are set. args is a list of
+// arguments that must be set in the passed Context.
+func argsSet(c *cli.Context, args ...string) error {
+ for _, a := range args {
+ if !c.IsSet(a) {
+ return errors.New(a + " is not set")
+ }
+ }
+ return nil
+}
+
+func initDB() error {
+ setting.NewContext()
+ models.LoadConfigs()
+
+ setting.NewXORMLogService(false)
+ if err := models.SetEngine(); err != nil {
+ return fmt.Errorf("models.SetEngine: %v", err)
+ }
+ return nil
+}
diff --git a/cmd/dump.go b/cmd/dump.go
index 588a2175d..bbefda63e 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -68,19 +68,19 @@ func runDump(ctx *cli.Context) error {
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
log.Fatalf("Path does not exist: %s", tmpDir)
}
- TmpWorkDir, err := ioutil.TempDir(tmpDir, "gitea-dump-")
+ tmpWorkDir, err := ioutil.TempDir(tmpDir, "gitea-dump-")
if err != nil {
log.Fatalf("Failed to create tmp work directory: %v", err)
}
- log.Printf("Creating tmp work dir: %s", TmpWorkDir)
+ log.Printf("Creating tmp work dir: %s", tmpWorkDir)
// work-around #1103
if os.Getenv("TMPDIR") == "" {
- os.Setenv("TMPDIR", TmpWorkDir)
+ os.Setenv("TMPDIR", tmpWorkDir)
}
- reposDump := path.Join(TmpWorkDir, "gitea-repo.zip")
- dbDump := path.Join(TmpWorkDir, "gitea-db.sql")
+ reposDump := path.Join(tmpWorkDir, "gitea-repo.zip")
+ dbDump := path.Join(tmpWorkDir, "gitea-db.sql")
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
zip.Verbose = ctx.Bool("verbose")
@@ -146,10 +146,10 @@ func runDump(ctx *cli.Context) error {
log.Printf("Can't change file access permissions mask to 0600: %v", err)
}
- log.Printf("Removing tmp work dir: %s", TmpWorkDir)
+ log.Printf("Removing tmp work dir: %s", tmpWorkDir)
- if err := os.RemoveAll(TmpWorkDir); err != nil {
- log.Fatalf("Failed to remove %s: %v", TmpWorkDir, err)
+ if err := os.RemoveAll(tmpWorkDir); err != nil {
+ log.Fatalf("Failed to remove %s: %v", tmpWorkDir, err)
}
log.Printf("Finish dumping in file %s", fileName)
diff --git a/cmd/hook.go b/cmd/hook.go
index 9d805e4ef..02eb30a13 100644
--- a/cmd/hook.go
+++ b/cmd/hook.go
@@ -37,7 +37,7 @@ var (
},
Subcommands: []cli.Command{
subcmdHookPreReceive,
- subcmdHookUpadte,
+ subcmdHookUpdate,
subcmdHookPostReceive,
},
}
@@ -48,7 +48,7 @@ var (
Description: "This command should only be called by Git",
Action: runHookPreReceive,
}
- subcmdHookUpadte = cli.Command{
+ subcmdHookUpdate = cli.Command{
Name: "update",
Usage: "Delegate update Git hook",
Description: "This command should only be called by Git",
diff --git a/cmd/web.go b/cmd/web.go
index 473688a8b..bc3cee69e 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -121,11 +121,9 @@ func runWeb(ctx *cli.Context) error {
}
}
- var listenAddr string
- if setting.Protocol == setting.UnixSocket {
- listenAddr = fmt.Sprintf("%s", setting.HTTPAddr)
- } else {
- listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort)
+ listenAddr := setting.HTTPAddr
+ if setting.Protocol != setting.UnixSocket {
+ listenAddr += ":" + setting.HTTPPort
}
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
@@ -135,6 +133,7 @@ func runWeb(ctx *cli.Context) error {
if setting.EnablePprof {
go func() {
+ log.Info("Starting pprof server on localhost:6060")
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
}()
}
diff --git a/models/user.go b/models/user.go
index c30c66d6c..da9411dcb 100644
--- a/models/user.go
+++ b/models/user.go
@@ -138,6 +138,22 @@ func (u *User) BeforeUpdate() {
if u.MaxRepoCreation < -1 {
u.MaxRepoCreation = -1
}
+
+ // Organization does not need email
+ u.Email = strings.ToLower(u.Email)
+ if !u.IsOrganization() {
+ if len(u.AvatarEmail) == 0 {
+ u.AvatarEmail = u.Email
+ }
+ if len(u.AvatarEmail) > 0 {
+ u.Avatar = base.HashEmail(u.AvatarEmail)
+ }
+ }
+
+ u.LowerName = strings.ToLower(u.Name)
+ u.Location = base.TruncateString(u.Location, 255)
+ u.Website = base.TruncateString(u.Website, 255)
+ u.Description = base.TruncateString(u.Description, 255)
}
// SetLastLogin set time to last login
@@ -388,17 +404,20 @@ func (u *User) NewGitSig() *git.Signature {
}
}
+func hashPassword(passwd, salt string) string {
+ tempPasswd := pbkdf2.Key([]byte(passwd), []byte(salt), 10000, 50, sha256.New)
+ return fmt.Sprintf("%x", tempPasswd)
+}
+
// HashPassword hashes a password using PBKDF.
-func (u *User) HashPassword() {
- newPasswd := pbkdf2.Key([]byte(u.Passwd), []byte(u.Salt), 10000, 50, sha256.New)
- u.Passwd = fmt.Sprintf("%x", newPasswd)
+func (u *User) HashPassword(passwd string) {
+ u.Passwd = hashPassword(passwd, u.Salt)
}
// ValidatePassword checks if given password matches the one belongs to the user.
func (u *User) ValidatePassword(passwd string) bool {
- newUser := &User{Passwd: passwd, Salt: u.Salt}
- newUser.HashPassword()
- return subtle.ConstantTimeCompare([]byte(u.Passwd), []byte(newUser.Passwd)) == 1
+ tempHash := hashPassword(passwd, u.Salt)
+ return subtle.ConstantTimeCompare([]byte(u.Passwd), []byte(tempHash)) == 1
}
// IsPasswordSet checks if the password is set or left empty
@@ -711,7 +730,7 @@ func CreateUser(u *User) (err error) {
if u.Salt, err = GetUserSalt(); err != nil {
return err
}
- u.HashPassword()
+ u.HashPassword(u.Passwd)
u.AllowCreateOrganization = setting.Service.DefaultAllowCreateOrganization
u.MaxRepoCreation = -1
@@ -837,22 +856,6 @@ func checkDupEmail(e Engine, u *User) error {
}
func updateUser(e Engine, u *User) error {
- // Organization does not need email
- u.Email = strings.ToLower(u.Email)
- if !u.IsOrganization() {
- if len(u.AvatarEmail) == 0 {
- u.AvatarEmail = u.Email
- }
- if len(u.AvatarEmail) > 0 {
- u.Avatar = base.HashEmail(u.AvatarEmail)
- }
- }
-
- u.LowerName = strings.ToLower(u.Name)
- u.Location = base.TruncateString(u.Location, 255)
- u.Website = base.TruncateString(u.Website, 255)
- u.Description = base.TruncateString(u.Description, 255)
-
_, err := e.ID(u.ID).AllCols().Update(u)
return err
}
@@ -868,22 +871,6 @@ func UpdateUserCols(u *User, cols ...string) error {
}
func updateUserCols(e Engine, u *User, cols ...string) error {
- // Organization does not need email
- u.Email = strings.ToLower(u.Email)
- if !u.IsOrganization() {
- if len(u.AvatarEmail) == 0 {
- u.AvatarEmail = u.Email
- }
- if len(u.AvatarEmail) > 0 {
- u.Avatar = base.HashEmail(u.AvatarEmail)
- }
- }
-
- u.LowerName = strings.ToLower(u.Name)
- u.Location = base.TruncateString(u.Location, 255)
- u.Website = base.TruncateString(u.Website, 255)
- u.Description = base.TruncateString(u.Description, 255)
-
_, err := e.ID(u.ID).Cols(cols...).Update(u)
return err
}
diff --git a/models/user_test.go b/models/user_test.go
index c0b7dace7..4fd0bc0fa 100644
--- a/models/user_test.go
+++ b/models/user_test.go
@@ -135,13 +135,11 @@ func TestHashPasswordDeterministic(t *testing.T) {
pass := string(b)
// save the current password in the user - hash it and store the result
- u.Passwd = pass
- u.HashPassword()
+ u.HashPassword(pass)
r1 := u.Passwd
// run again
- u.Passwd = pass
- u.HashPassword()
+ u.HashPassword(pass)
r2 := u.Passwd
// assert equal (given the same salt+pass, the same result is produced)
@@ -158,7 +156,6 @@ func BenchmarkHashPassword(b *testing.B) {
u := &User{Salt: string(bs), Passwd: pass}
b.ResetTimer()
for i := 0; i < b.N; i++ {
- u.HashPassword()
- u.Passwd = pass
+ u.HashPassword(pass)
}
}
diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini
index 648a56590..1a45c2c37 100644
--- a/options/locale/locale_de-DE.ini
+++ b/options/locale/locale_de-DE.ini
@@ -63,7 +63,6 @@ cancel=Abbrechen
install=Installation
title=Erstkonfiguration
docker_helper=Wenn du Gitea in einem Docker-Container nutzt, lies bitte die Hinweise sorgfältig, bevor du irgendetwas auf dieser Seite veränderst.
-requite_db_desc=Gitea benötigt MySQL, PostgreSQL, SQLite3 oder TiDB.
db_title=Datenbankeinstellungen
db_type=Datenbanktyp
host=Host
@@ -401,6 +400,8 @@ valid_until=Gültig bis
valid_forever=Gültig für immer
last_used=Zuletzt verwendet am
no_activity=Keine neuen Aktivitäten
+can_read_info=Lesezugriff
+can_write_info=Schreibzugriff
key_state_desc=Dieser Schlüssel wurde in den letzten 7 Tagen verwendet
token_state_desc=Dieser Token wurde in den letzten 7 Tagen benutzt
show_openid=Im Profil anzeigen
@@ -755,7 +756,12 @@ pulls.is_checking=Die Konfliktprüfung läuft noch. Bitte aktualisiere die Seite
pulls.can_auto_merge_desc=Dieser Pull-Request kann automatisch zusammengeführt werden.
pulls.cannot_auto_merge_desc=Dieser Pull-Request kann nicht automatisch zusammengeführt werden, da es Konflikte gibt.
pulls.cannot_auto_merge_helper=Bitte manuell zusammenführen, um die Konflikte zu lösen.
+pulls.no_merge_desc=Dieser Pull-Request kann nicht gemerged werden, da keine Mergeoptionen aktiviert sind.
+pulls.no_merge_helper=Um diesen Pull-Request zu mergen musst du mindestens eine Mergeoption aktivieren oder den Pull-Request manuell mergen.
pulls.merge_pull_request=Pull-Request zusammenführen
+pulls.rebase_merge_pull_request=Rebase und Mergen
+pulls.squash_merge_pull_request=Zusammenfassen und Mergen
+pulls.invalid_merge_option=Du kannst diese Mergeoption auf diesen Pull-Request nicht anwenden
pulls.open_unmerged_pull_exists=`Du kannst diesen Pull-Request nicht wieder öffnen, da bereits ein offener Pull-Request (#%d) aus dem selben Repository mit den gleichen Merge-Informationen existiert und auf das Zusammenführen wartet.`
milestones.new=Neuer Meilenstein
@@ -894,6 +900,10 @@ settings.tracker_url_format_desc=Du kannst die Platzhalter {user} {repo} {
settings.enable_timetracker=Zeiterfassung einschalten
settings.allow_only_contributors_to_track_time=Nur Contributors erlauben, die Zeiterfassung zu nutzen
settings.pulls_desc=Pull-Requests aktivieren, um öffentliche Mitwirkung zu ermöglichen
+settings.pulls.ignore_whitespace=Beim Überprüfen auf Konflikte Leerzeichenänderungen ignorieren
+settings.pulls.allow_merge_commits=Mergecommits erlauben
+settings.pulls.allow_rebase_merge=Mergen von Commits durch Rebase erlauben
+settings.pulls.allow_squash_commits=Squash-Commits vor dem Mergen erlauben
settings.danger_zone=Gefahrenzone
settings.new_owner_has_same_repo=Der neue Eigentümer hat bereits ein Repository mit dem gleichen Namen. Bitte wähle einen anderen Namen.
settings.convert=In ein normales Repository umwandeln
@@ -986,6 +996,8 @@ settings.add_dingtalk_hook_desc=Dingtalk-Integration zu deinem
settings.deploy_keys=Deploy-Schlüssel
settings.add_deploy_key=Deploy-Schlüssel hinzufügen
settings.deploy_key_desc=Deploy-Schlüssel haben nur lesenden Zugriff. Sie sind nicht identisch mit dem SSH-Schlüssel des persönlichen Kontos.
+settings.is_writable=Schreibzugriff erlauben
+settings.is_writable_info=Soll dieser Schlüssel push-Rechte haben? Deploy-Schlüssel haben immer pull-Recht.
settings.no_deploy_keys=Du hast noch keine Deploy-Schlüssel hinzugefügt.
settings.title=Titel
settings.deploy_key_content=Inhalt
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index fa80bea67..aa2c5e1c7 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -63,7 +63,7 @@ cancel = Cancel
install = Installation
title = Initial configuration
docker_helper = If you are running Gitea inside Docker, please read the guidelines carefully before changing anything on this page.
-requite_db_desc = Gitea requires MySQL, PostgreSQL, SQLite3, or TiDB.
+requite_db_desc = Gitea requires MySQL, MSSQL, PostgreSQL, SQLite3, or TiDB.
db_title = Database Settings
db_type = Database Type
host = Host
diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini
index 612d8a6c4..e5d89f426 100644
--- a/options/locale/locale_es-ES.ini
+++ b/options/locale/locale_es-ES.ini
@@ -62,7 +62,6 @@ cancel=Cancelar
install=Instalación
title=Configuración inicial
docker_helper=Si estás ejecutando Gitea dentro de Docker, por favor lee las pautas antes de cambiar nada en esta página.
-requite_db_desc=Gitea requiere MySQL, PostgreSQL, SQLite3 o TiDB.
db_title=Configuración de base de datos
db_type=Tipo de base de datos
host=Servidor
diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini
index 2dca3fc11..7c450d273 100644
--- a/options/locale/locale_fr-FR.ini
+++ b/options/locale/locale_fr-FR.ini
@@ -63,7 +63,6 @@ cancel=Annuler
install=Installation
title=Configuration initiale
docker_helper=Si vous exécutez Gitea grâce à Docker, merci de lire la procédure attentivement avant de modifier quoi que ce soit sur cette page.
-requite_db_desc=Gitea requiert MySQL, PostgreSQL, SQLite3 ou TiDB.
db_title=Paramètres de la base de données
db_type=Type de base de données
host=Hôte
diff --git a/options/locale/locale_hu-HU.ini b/options/locale/locale_hu-HU.ini
index 9b804c643..550d3bba2 100644
--- a/options/locale/locale_hu-HU.ini
+++ b/options/locale/locale_hu-HU.ini
@@ -63,7 +63,7 @@ cancel=Mégse
install=Telepítés
title=Kezdeti konfiguráció
docker_helper=Ha Docker-en belül futtatja a Gitea-t, kérjük olvassa el az irányelveket mielőtt bármit megváltoztatna ezen az oldalon.
-requite_db_desc=A Giteához MySQL, PostgreSQL, SQLite3 vagy TiDB adatbázis szükséges.
+requite_db_desc=A Giteához MySQL, Microsoft SQL, PostgreSQL, SQLite3 vagy TiDB adatbázis szükséges.
db_title=Adatbázis beállítások
db_type=Adatbázis típusa
host=Kiszolgáló
diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini
index a7660ef20..50ce0f5e0 100644
--- a/options/locale/locale_ja-JP.ini
+++ b/options/locale/locale_ja-JP.ini
@@ -58,7 +58,6 @@ cancel=キャンセル
[install]
install=インストール
title=初期設定
-requite_db_desc=Gitea には、MySQL、PostgreSQL、SQLite3、または TiDB が必要です。
db_title=データベース設定
db_type=データベースの種類
host=ホスト
diff --git a/options/locale/locale_ko-KR.ini b/options/locale/locale_ko-KR.ini
index 403fd6c97..f391fc1d5 100644
--- a/options/locale/locale_ko-KR.ini
+++ b/options/locale/locale_ko-KR.ini
@@ -53,7 +53,6 @@ cancel=취소
[install]
install=설치
title=초기 설정
-requite_db_desc=Gitea는 MySQL, PostgreSQL, SQLite3 또는 TiDB가 필요입니다.
db_title=데이터베이스 설정
db_type=데이터베이스 유형
host=호스트
diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini
index ed0904b23..b27557d79 100644
--- a/options/locale/locale_lv-LV.ini
+++ b/options/locale/locale_lv-LV.ini
@@ -63,7 +63,7 @@ cancel=Atcelt
install=Instalācija
title=Sākotnējā konfigurācija
docker_helper=Ja Gitea ir uzstādīts Docker konteinerī, izlasiet vadlīnijas pirms ko mainiet šajā lapā.
-requite_db_desc=Gitea nepieciešams MySQL, PostgreSQL, SQLite3 vai TiDB.
+requite_db_desc=Gitea nepieciešams MySQL, Microsoft SQL Server, PostgreSQL, SQLite3 vai TiDB.
db_title=Datu bāzes iestatījumi
db_type=Datu bāzes veids
host=Resursdators
diff --git a/options/locale/locale_nb-NO.ini b/options/locale/locale_nb-NO.ini
index 8b16d2aab..e62b363bc 100644
--- a/options/locale/locale_nb-NO.ini
+++ b/options/locale/locale_nb-NO.ini
@@ -63,7 +63,6 @@ cancel=Avbryt
install=Installasjon
title=Standardkonfigurasjon
docker_helper=Hvis du kjører Gitea i Docker, vennligst les retningslinjene nøye før du gjør endringer på denne siden.
-requite_db_desc=Gogs krever MySQL, PostgreSQL, SQLite3 eller TiDB.
db_title=Databaseinnstillinger
db_type=Databasetype
host=Tjener
diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini
index f29875ebe..fd4b43b61 100644
--- a/options/locale/locale_nl-NL.ini
+++ b/options/locale/locale_nl-NL.ini
@@ -61,7 +61,6 @@ cancel=Annuleren
install=Installatie
title=Initiële configuratie
docker_helper=Als u gebruik maakt van Gitea in Docker, lees dan de richtlijnen voordat u iets verandert op deze pagina.
-requite_db_desc=Gitea vereist MySQL, PostgreSQL, SQLite3 of TiDB.
db_title=Database-instellingen
db_type=Database-type
host=Server
diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini
index ad9b238b7..fed77ef04 100644
--- a/options/locale/locale_pl-PL.ini
+++ b/options/locale/locale_pl-PL.ini
@@ -63,7 +63,6 @@ cancel=Anuluj
install=Instalacja
title=Wstępna konfiguracja
docker_helper=Jeśli używasz Gitea wewnątrz Dockera, proszę przeczytaj wytyczne zanim zmienisz coś na tej stronie.
-requite_db_desc=Gitea wymaga MySQL, PostgreSQL, SQLite3 lub TiDB.
db_title=Ustawienia bazy danych
db_type=Typ bazy danych
host=Serwer
diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini
index fdb377510..3d2bf1673 100644
--- a/options/locale/locale_pt-BR.ini
+++ b/options/locale/locale_pt-BR.ini
@@ -63,7 +63,6 @@ cancel=Cancelar
install=Instalação
title=Configuração inicial
docker_helper=Se você está rodando o Gitea dentro do Docker, por favor leia as instruções cuidadosamente antes de alterar qualquer coisa nesta página.
-requite_db_desc=Gitea requer MySQL, PostgreSQL, SQLite3 ou TiDB.
db_title=Configurações de banco de dados
db_type=Tipo de banco de dados
host=Servidor
diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini
index 9a541ab77..355f5b283 100644
--- a/options/locale/locale_ru-RU.ini
+++ b/options/locale/locale_ru-RU.ini
@@ -63,7 +63,7 @@ cancel=Отмена
install=Установка
title=Начальная конфигурация
docker_helper=Если вы запускаете Gitea внутри Docker, пожалуйста внимательно прочтите эти советы перед тем как что-либо изменить на этой странице.
-requite_db_desc=Gitea требует MySQL, PostgreSQL, SQLite3 или TiDB.
+requite_db_desc=Gitea требует MySQL, MSSQL, PostgreSQL, SQLite3 или TiDB.
db_title=Настройки базы данных
db_type=Тип базы данных
host=Хост
diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini
index e41376150..42d9f4169 100644
--- a/options/locale/locale_sv-SE.ini
+++ b/options/locale/locale_sv-SE.ini
@@ -57,7 +57,6 @@ cancel=Avbryt
install=Installation
title=Inledande konfiguration
docker_helper=Om du kör Gitea inuti Docker, vänligen läs riktninjerna noggrant innan du ändrar någonting på denna sida.
-requite_db_desc=Gitea kräver MySQL, PostgreSQL, SQLite3 eller TiDB.
db_title=Databasinställningar
db_type=Databastyp
host=Server
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index 6bb366eee..bbad7fa34 100644
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -63,7 +63,6 @@ cancel=取消
install=安装页面
title=初始配置
docker_helper=如果您正在使用 Docker 容器运行 Gitea,请务必先仔细阅读 官方文档 后再对本页面进行填写。
-requite_db_desc=Gitea 要求安装 MySQL、PostgreSQL、SQLite3 或 TiDB。
db_title=数据库设置
db_type=数据库类型
host=数据库主机
diff --git a/options/locale/locale_zh-HK.ini b/options/locale/locale_zh-HK.ini
index b5824510c..05b640266 100644
--- a/options/locale/locale_zh-HK.ini
+++ b/options/locale/locale_zh-HK.ini
@@ -60,7 +60,6 @@ cancel=取消
install=安裝頁面
title=初始設定
docker_helper=如果您正在 Docker 中執行 Gitea,請先仔細閱讀官方文件後,再對本頁面進行填寫。
-requite_db_desc=Gitea 要求安裝 MySQL、PostgreSQL、SQLite3 或 TiDB。
db_title=資料庫設定
db_type=資料庫類型
host=主機
diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini
index 89d3b929a..b1ca2dd64 100644
--- a/options/locale/locale_zh-TW.ini
+++ b/options/locale/locale_zh-TW.ini
@@ -63,7 +63,6 @@ cancel=取消
install=安裝頁面
title=初始設定
docker_helper=如果您正在使用 Docker 容器運行 Gitea,請務必先仔細閱讀 官方文檔 後再對本頁面進行填寫。
-requite_db_desc=Gitea 要求安裝 MySQL、PostgreSQL、SQLite3 或 TiDB。
db_title=資料庫設定
db_type=資料庫類型
host=主機
diff --git a/routers/admin/users.go b/routers/admin/users.go
index eee0c21f4..9aa78db10 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -194,13 +194,12 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
}
if len(form.Password) > 0 {
- u.Passwd = form.Password
var err error
if u.Salt, err = models.GetUserSalt(); err != nil {
ctx.ServerError("UpdateUser", err)
return
}
- u.HashPassword()
+ u.HashPassword(form.Password)
}
u.LoginName = form.LoginName
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 5bbb8a7af..69e1761b0 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -126,13 +126,12 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
}
if len(form.Password) > 0 {
- u.Passwd = form.Password
var err error
if u.Salt, err = models.GetUserSalt(); err != nil {
ctx.Error(500, "UpdateUser", err)
return
}
- u.HashPassword()
+ u.HashPassword(form.Password)
}
u.LoginName = form.LoginName
diff --git a/routers/org/org.go b/routers/org/org.go
index 665d1a71f..bb7540277 100644
--- a/routers/org/org.go
+++ b/routers/org/org.go
@@ -22,10 +22,6 @@ const (
// Create render the page for create organization
func Create(ctx *context.Context) {
- if !ctx.User.CanCreateOrganization() {
- ctx.NotFound("CanCreateOrganization", nil)
- }
-
ctx.Data["Title"] = ctx.Tr("new_org")
if !ctx.User.CanCreateOrganization() {
ctx.ServerError("Not allowed", errors.New(ctx.Tr("org.form.create_org_not_allowed")))
@@ -36,12 +32,13 @@ func Create(ctx *context.Context) {
// CreatePost response for create organization
func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
- if !ctx.User.CanCreateOrganization() {
- ctx.NotFound("CanCreateOrganization", nil)
- }
-
ctx.Data["Title"] = ctx.Tr("new_org")
+ if !ctx.User.CanCreateOrganization() {
+ ctx.ServerError("Not allowed", errors.New(ctx.Tr("org.form.create_org_not_allowed")))
+ return
+ }
+
if ctx.HasError() {
ctx.HTML(200, tplCreateOrg)
return
diff --git a/routers/user/auth.go b/routers/user/auth.go
index c3fb911b0..6edcb914b 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -984,7 +984,6 @@ func ResetPasswdPost(ctx *context.Context) {
return
}
- u.Passwd = passwd
var err error
if u.Rands, err = models.GetUserSalt(); err != nil {
ctx.ServerError("UpdateUser", err)
@@ -994,7 +993,7 @@ func ResetPasswdPost(ctx *context.Context) {
ctx.ServerError("UpdateUser", err)
return
}
- u.HashPassword()
+ u.HashPassword(passwd)
if err := models.UpdateUserCols(u, "passwd", "rands", "salt"); err != nil {
ctx.ServerError("UpdateUser", err)
return
diff --git a/routers/user/setting.go b/routers/user/setting.go
index dcd0eedb8..b674c24b4 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -229,13 +229,12 @@ func SettingsSecurityPost(ctx *context.Context, form auth.ChangePasswordForm) {
} else if form.Password != form.Retype {
ctx.Flash.Error(ctx.Tr("form.password_not_match"))
} else {
- ctx.User.Passwd = form.Password
var err error
if ctx.User.Salt, err = models.GetUserSalt(); err != nil {
ctx.ServerError("UpdateUser", err)
return
}
- ctx.User.HashPassword()
+ ctx.User.HashPassword(form.Password)
if err := models.UpdateUserCols(ctx.User, "salt", "passwd"); err != nil {
ctx.ServerError("UpdateUser", err)
return