]> source.dussan.org Git - gitea.git/commitdiff
Increase Username and Orgname MaxSize 35 -> 40 (#6178)
authorSegev Finer <segev208@gmail.com>
Mon, 25 Feb 2019 18:56:47 +0000 (20:56 +0200)
committertechknowlogick <matti@mdranta.net>
Mon, 25 Feb 2019 18:56:47 +0000 (13:56 -0500)
* 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>
Gopkg.lock
modules/auth/admin.go
modules/auth/org.go
modules/auth/user_form.go
modules/auth/user_form_auth_openid.go
templates/swagger/v1_json.tmpl
vendor/code.gitea.io/sdk/gitea/admin_user.go
vendor/code.gitea.io/sdk/gitea/gitea.go
vendor/code.gitea.io/sdk/gitea/issue.go

index 3ef6f552ed75caa9fde84d9493bc4187d0bfe064..9c53d8af351e83b9718e42ab76fada72303390fa 100644 (file)
 
 [[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 = [
index fb86a047648c16998b971ce624f28682bfe2a52a..8f8dd8f22a21167e3c7678d142efbdebda1c5abb 100644 (file)
@@ -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
index e4921c2267ee3f4710055a5bc6b28316834126a4..d51ab75d3a30a44e3de44a3bdafc6e5d68fc5165 100644 (file)
@@ -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)"`
index f59b795b4e309c472eec6e033b16c638ee2f78dd..3a4df8ea7d223edd5e8bbde5903f76b97476a4ef 100644 (file)
@@ -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
index 6a3c2848730edd4a058dc5483dc62f63f1204027..275850d09a186b3c5d7d8fca92da58bd2868b3ed 100644 (file)
@@ -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"`
 }
index a24bf3838cf3bff552302dfe4758be64bfbe89ec..b825c20db72d6c947880c0d0243b4e82164b1b63 100644 (file)
           "type": "string",
           "x-go-name": "LoginName"
         },
+        "must_change_password": {
+          "type": "boolean",
+          "x-go-name": "MustChangePassword"
+        },
         "password": {
           "type": "string",
           "x-go-name": "Password"
           "format": "int64",
           "x-go-name": "MaxRepoCreation"
         },
+        "must_change_password": {
+          "type": "boolean",
+          "x-go-name": "MustChangePassword"
+        },
         "password": {
           "type": "string",
           "x-go-name": "Password"
index 089ff2964495b6cd851a82a67a022aad94c45e27..a87ae89d442fb7ffe8852e4d57b8ee6908e9ed74 100644 (file)
@@ -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"`
index a5509b2abada0532c4f4f8cc1066f8464073fc74..d90a6ebc15356e26f7aec0efc98908f06b489a45 100644 (file)
@@ -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
        }
index 8fc2b2bf7b13736175e403874a31c5387a6bf5a1..0a1defb6f356394a75cee4a0b1c635c80945c92c 100644 (file)
@@ -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