aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSegev Finer <segev208@gmail.com>2019-02-25 20:56:47 +0200
committertechknowlogick <matti@mdranta.net>2019-02-25 13:56:47 -0500
commit594f59169129889387d792f6aa571150d4118dc6 (patch)
treeef4ba7db59acf97a5a2fd0d243d13958e3282811
parent795f6e04ad7e42d168b85d44ec17eab31d741808 (diff)
downloadgitea-594f59169129889387d792f6aa571150d4118dc6.tar.gz
gitea-594f59169129889387d792f6aa571150d4118dc6.zip
Increase Username and Orgname MaxSize 35 -> 40 (#6178)
* Increase Username and Orgname MaxSize 35 -> 40 Signed-off-by: Segev Finer <segev@codeocean.com> * Dep update code.gitea.io/sdk Signed-off-by: Segev Finer <segev@codeocean.com> * Run generate-swagger Signed-off-by: Segev Finer <segev@codeocean.com>
-rw-r--r--Gopkg.lock5
-rw-r--r--modules/auth/admin.go2
-rw-r--r--modules/auth/org.go4
-rw-r--r--modules/auth/user_form.go4
-rw-r--r--modules/auth/user_form_auth_openid.go2
-rw-r--r--templates/swagger/v1_json.tmpl8
-rw-r--r--vendor/code.gitea.io/sdk/gitea/admin_user.go9
-rw-r--r--vendor/code.gitea.io/sdk/gitea/gitea.go9
-rw-r--r--vendor/code.gitea.io/sdk/gitea/issue.go16
9 files changed, 47 insertions, 12 deletions
diff --git a/Gopkg.lock b/Gopkg.lock
index 3ef6f552ed..9c53d8af35 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -11,11 +11,11 @@
[[projects]]
branch = "master"
- digest = "1:17c6c3f4af27f721e3176aceeb2ee30621547a44c81ada0ce733170b9bdfee19"
+ digest = "1:784d7948aaae61b9fe50aa15c69a62fb277268a47ed006748a7e25fa61b841c9"
name = "code.gitea.io/sdk"
packages = ["gitea"]
pruneopts = "NUT"
- revision = "b9e72373fbe3001d98ce7395221d0134b9456679"
+ revision = "4a15722a627a9cf62a203a066e724e82556b3845"
[[projects]]
digest = "1:5d72bbcc9c8667b11c3dc3cbe681c5a6f71e5096744c0bf7726ab5c6425d5dc4"
@@ -90,7 +90,6 @@
revision = "3a771d992973f24aa725d07868b467d1ddfceafb"
[[projects]]
- branch = "master"
digest = "1:b17287a86f6cac923a5d886e10618df994eeb54b6724eac2e3b8dde89cfbe3a2"
name = "github.com/blevesearch/bleve"
packages = [
diff --git a/modules/auth/admin.go b/modules/auth/admin.go
index fb86a04764..8f8dd8f22a 100644
--- a/modules/auth/admin.go
+++ b/modules/auth/admin.go
@@ -14,7 +14,7 @@ import (
type AdminCreateUserForm struct {
LoginType string `binding:"Required"`
LoginName string
- UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
+ UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
Email string `binding:"Required;Email;MaxSize(254)"`
Password string `binding:"MaxSize(255)"`
SendNotify bool
diff --git a/modules/auth/org.go b/modules/auth/org.go
index e4921c2267..d51ab75d3a 100644
--- a/modules/auth/org.go
+++ b/modules/auth/org.go
@@ -22,7 +22,7 @@ import (
// CreateOrgForm form for creating organization
type CreateOrgForm struct {
- OrgName string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
+ OrgName string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
Visibility structs.VisibleType
}
@@ -33,7 +33,7 @@ func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) bind
// UpdateOrgSettingForm form for updating organization settings
type UpdateOrgSettingForm struct {
- Name string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
+ Name string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
FullName string `binding:"MaxSize(100)"`
Description string `binding:"MaxSize(255)"`
Website string `binding:"ValidUrl;MaxSize(255)"`
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go
index f59b795b4e..3a4df8ea7d 100644
--- a/modules/auth/user_form.go
+++ b/modules/auth/user_form.go
@@ -76,7 +76,7 @@ func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) bindin
// RegisterForm form for registering
type RegisterForm struct {
- UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
+ UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
Email string `binding:"Required;Email;MaxSize(254)"`
Password string `binding:"Required;MaxSize(255)"`
Retype string
@@ -146,7 +146,7 @@ func (f *SignInForm) Validate(ctx *macaron.Context, errs binding.Errors) binding
// UpdateProfileForm form for updating profile
type UpdateProfileForm struct {
- Name string `binding:"AlphaDashDot;MaxSize(35)"`
+ Name string `binding:"AlphaDashDot;MaxSize(40)"`
FullName string `binding:"MaxSize(100)"`
Email string `binding:"Required;Email;MaxSize(254)"`
KeepEmailPrivate bool
diff --git a/modules/auth/user_form_auth_openid.go b/modules/auth/user_form_auth_openid.go
index 6a3c284873..275850d09a 100644
--- a/modules/auth/user_form_auth_openid.go
+++ b/modules/auth/user_form_auth_openid.go
@@ -22,7 +22,7 @@ func (f *SignInOpenIDForm) Validate(ctx *macaron.Context, errs binding.Errors) b
// SignUpOpenIDForm form for signin up with OpenID
type SignUpOpenIDForm struct {
- UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
+ UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
Email string `binding:"Required;Email;MaxSize(254)"`
GRecaptchaResponse string `form:"g-recaptcha-response"`
}
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index a24bf3838c..b825c20db7 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -6924,6 +6924,10 @@
"type": "string",
"x-go-name": "LoginName"
},
+ "must_change_password": {
+ "type": "boolean",
+ "x-go-name": "MustChangePassword"
+ },
"password": {
"type": "string",
"x-go-name": "Password"
@@ -7342,6 +7346,10 @@
"format": "int64",
"x-go-name": "MaxRepoCreation"
},
+ "must_change_password": {
+ "type": "boolean",
+ "x-go-name": "MustChangePassword"
+ },
"password": {
"type": "string",
"x-go-name": "Password"
diff --git a/vendor/code.gitea.io/sdk/gitea/admin_user.go b/vendor/code.gitea.io/sdk/gitea/admin_user.go
index 089ff29644..a87ae89d44 100644
--- a/vendor/code.gitea.io/sdk/gitea/admin_user.go
+++ b/vendor/code.gitea.io/sdk/gitea/admin_user.go
@@ -1,4 +1,5 @@
// Copyright 2015 The Gogs Authors. All rights reserved.
+// Copyright 2019 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.
@@ -15,14 +16,15 @@ type CreateUserOption struct {
SourceID int64 `json:"source_id"`
LoginName string `json:"login_name"`
// required: true
- Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
+ Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(40)"`
FullName string `json:"full_name" binding:"MaxSize(100)"`
// required: true
// swagger:strfmt email
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
// required: true
- Password string `json:"password" binding:"Required;MaxSize(255)"`
- SendNotify bool `json:"send_notify"`
+ Password string `json:"password" binding:"Required;MaxSize(255)"`
+ MustChangePassword bool `json:"must_change_password"`
+ SendNotify bool `json:"send_notify"`
}
// AdminCreateUser create a user
@@ -44,6 +46,7 @@ type EditUserOption struct {
// swagger:strfmt email
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
Password string `json:"password" binding:"MaxSize(255)"`
+ MustChangePassword bool `json:"must_change_password"`
Website string `json:"website" binding:"MaxSize(50)"`
Location string `json:"location" binding:"MaxSize(50)"`
Active *bool `json:"active"`
diff --git a/vendor/code.gitea.io/sdk/gitea/gitea.go b/vendor/code.gitea.io/sdk/gitea/gitea.go
index a5509b2aba..d90a6ebc15 100644
--- a/vendor/code.gitea.io/sdk/gitea/gitea.go
+++ b/vendor/code.gitea.io/sdk/gitea/gitea.go
@@ -23,6 +23,7 @@ func Version() string {
type Client struct {
url string
accessToken string
+ sudo string
client *http.Client
}
@@ -40,12 +41,20 @@ func (c *Client) SetHTTPClient(client *http.Client) {
c.client = client
}
+// SetSudo sets username to impersonate.
+func (c *Client) SetSudo(sudo string) {
+ c.sudo = sudo
+}
+
func (c *Client) doRequest(method, path string, header http.Header, body io.Reader) (*http.Response, error) {
req, err := http.NewRequest(method, c.url+"/api/v1"+path, body)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "token "+c.accessToken)
+ if c.sudo != "" {
+ req.Header.Set("Sudo", c.sudo)
+ }
for k, v := range header {
req.Header[k] = v
}
diff --git a/vendor/code.gitea.io/sdk/gitea/issue.go b/vendor/code.gitea.io/sdk/gitea/issue.go
index 8fc2b2bf7b..0a1defb6f3 100644
--- a/vendor/code.gitea.io/sdk/gitea/issue.go
+++ b/vendor/code.gitea.io/sdk/gitea/issue.go
@@ -139,6 +139,22 @@ func (c *Client) EditIssue(owner, repo string, index int64, opt EditIssueOption)
jsonHeader, bytes.NewReader(body), issue)
}
+// StartIssueStopWatch starts a stopwatch for an existing issue for a given
+// repository
+func (c *Client) StartIssueStopWatch(owner, repo string, index int64) error {
+ _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/stopwatch/start", owner, repo, index),
+ jsonHeader, nil)
+ return err
+}
+
+// StopIssueStopWatch stops an existing stopwatch for an issue in a given
+// repository
+func (c *Client) StopIssueStopWatch(owner, repo string, index int64) error {
+ _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/stopwatch/stop", owner, repo, index),
+ jsonHeader, nil)
+ return err
+}
+
// EditDeadlineOption options for creating a deadline
type EditDeadlineOption struct {
// required:true