aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-05-01 20:57:11 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-05-01 20:57:11 +0800
commitcc1eb5643e3d28b6e23d3642bdf93670c33fa9c5 (patch)
tree7adfbed18647baf9d3e281b7f23c0dcd0828cc7d
parent52fbb9788aa80adb56c96389f73c878cc0fe8b42 (diff)
parenta2333d95d594a6aa4e77e78c2efe32991d3cf1ef (diff)
downloadgitea-cc1eb5643e3d28b6e23d3642bdf93670c33fa9c5.tar.gz
gitea-cc1eb5643e3d28b6e23d3642bdf93670c33fa9c5.zip
Merge branch 'dev' of https://github.com/gogits/gogs into dev
-rw-r--r--README.md10
-rw-r--r--README_ZH.md10
-rw-r--r--conf/app.ini4
-rw-r--r--doc/install_gogs_from_binary_on_ubuntu.md26
-rw-r--r--doc/install_gogs_from_source_on_ubuntu.md48
-rwxr-xr-xdockerfiles/build.sh.bak29
-rw-r--r--dockerfiles/images/gogits/Dockerfile2
-rw-r--r--dockerfiles/images/memcache/Dockerfile2
-rw-r--r--dockerfiles/images/mysql/Dockerfile2
-rw-r--r--dockerfiles/images/postgres/Dockerfile2
-rw-r--r--dockerfiles/images/redis/Dockerfile2
-rw-r--r--gogs.go2
-rw-r--r--models/action.go22
-rw-r--r--models/user.go1
-rw-r--r--modules/auth/auth.go6
-rw-r--r--modules/auth/user.go1
-rw-r--r--modules/base/base.go1
-rw-r--r--modules/middleware/binding.go12
-rw-r--r--routers/dev/template.go1
-rw-r--r--routers/user/setting.go1
-rw-r--r--templates/base/footer.tmpl2
-rw-r--r--templates/base/navbar.tmpl2
-rw-r--r--templates/user/profile.tmpl1
-rw-r--r--templates/user/setting.tmpl7
24 files changed, 56 insertions, 140 deletions
diff --git a/README.md b/README.md
index 7166daed75..8e00be5265 100644
--- a/README.md
+++ b/README.md
@@ -24,10 +24,10 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
## Overview
-- Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design, known issues, and change log.
+- Please see [Documentation](http://gogs.io/docs/intro/) for project design, known issues, and change log.
- See [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team.
- Try it before anything? Do it [online](http://try.gogits.org/Unknown/gogs) or go down to **Installation -> Install from binary** section!
-- Having troubles? Get help from [Troubleshooting](https://github.com/gogits/gogs/wiki/Troubleshooting).
+- Having troubles? Get help from [Troubleshooting](http://gogs.io/docs/intro/troubleshooting.md).
## Features
@@ -49,12 +49,12 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
## Installation
-Make sure you install [Prerequirements](https://github.com/gogits/gogs/wiki/Prerequirements) first.
+Make sure you install [Prerequirements](http://gogs.io/docs/installation/) first.
There are 3 ways to install Gogs:
-- [Install from binary](https://github.com/gogits/gogs/wiki/Install-from-binary): **STRONGLY RECOMMENDED**
-- [Install from source](https://github.com/gogits/gogs/wiki/Install-from-source)
+- [Install from binary](http://gogs.io/docs/installation/install_from_binary.md): **STRONGLY RECOMMENDED**
+- [Install from source](http://gogs.io/docs/installation/install_from_source.md)
- [Ship with Docker](https://github.com/gogits/gogs/tree/master/dockerfiles)
## Acknowledgments
diff --git a/README_ZH.md b/README_ZH.md
index 177c679a85..e4c92685fe 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -15,10 +15,10 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
## 项目概览
-- 有关项目设计、已知问题和变更日志,请通过 [Wiki](https://github.com/gogits/gogs/wiki) 查看。
+- 有关项目设计、已知问题和变更日志,请通过 [使用手册](http://gogs.io/docs/intro/) 查看。
- 您可以到 [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) 跟随开发团队的脚步。
- 想要先睹为快?通过 [在线体验](http://try.gogits.org/Unknown/gogs) 或查看 **安装部署 -> 二进制安装** 小节。
-- 使用过程中遇到问题?尝试从 [故障排查](https://github.com/gogits/gogs/wiki/Troubleshooting) 页面获取帮助。
+- 使用过程中遇到问题?尝试从 [故障排查](http://gogs.io/docs/intro/troubleshooting.md) 页面获取帮助。
## 功能特性
@@ -41,12 +41,12 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
## 安装部署
-在安装 Gogs 之前,您需要先安装 [基本环境](https://github.com/gogits/gogs/wiki/Prerequirements)。
+在安装 Gogs 之前,您需要先安装 [基本环境](http://gogs.io/docs/installation/)。
然后,您可以通过以下 3 种方式来安装 Gogs:
-- [二进制安装](https://github.com/gogits/gogs/wiki/Install-from-binary): **强烈推荐**
-- [源码安装](https://github.com/gogits/gogs/wiki/Install-from-source)
+- [二进制安装](http://gogs.io/docs/installation/install_from_binary.md): **强烈推荐**
+- [源码安装](http://gogs.io/docs/installation/install_from_source.md)
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/dockerfiles)
## 特别鸣谢
diff --git a/conf/app.ini b/conf/app.ini
index e7174e2251..6dfd198b2f 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -15,11 +15,9 @@ LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|
[server]
PROTOCOL = http
DOMAIN = localhost
-ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
+ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:3000/
; Disable CDN even in "prod" mode
OFFLINE_MODE = false
-HTTP_ADDR =
-HTTP_PORT = 3000
; Generate steps:
; $ cd path/to/gogs/custom/https
; $ go run $GOROOT/src/pkg/crypto/tls/generate_cert.go -ca=true -duration=8760h0m0s -host=myhost.example.com
diff --git a/doc/install_gogs_from_binary_on_ubuntu.md b/doc/install_gogs_from_binary_on_ubuntu.md
deleted file mode 100644
index 3b406b3643..0000000000
--- a/doc/install_gogs_from_binary_on_ubuntu.md
+++ /dev/null
@@ -1,26 +0,0 @@
-### Binary install gogs on ubuntu 14.04 LTS
-
-### create user and install denpendency
-- sudo adduser git
-- sudo apt-get update
-- sudo apt-get upgrade
-- sudo apt-get install git
-- sudo apt-get install mysql-server
-
-### create the database
-- $mysql -u root -p
-- mysql> SET GLOBAL storage_engine = 'InnoDB';
-- mysql> CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_bin;
-- mysql> GRANT ALL PRIVILEGES ON gogs.* TO 'root'@'localhost' IDENTIFIED BY 'password';
-- mysql> FLUSH PRIVILEGES;
-- mysql> QUIT
-
-### install the gogs
-- mkdir gogs
-- cd gogs
-- curl -L http://gobuild.io/github.com/gogits/gogs/v0.3.0/linux/amd64 -o v0.3.0.zip
-- unzip v0.3.0.zip
-- ./start.sh
-
-> The up-to-date binary could be found at
-> http://gobuild.io/download/github.com/gogits/gogs
diff --git a/doc/install_gogs_from_source_on_ubuntu.md b/doc/install_gogs_from_source_on_ubuntu.md
deleted file mode 100644
index b8ae6fc790..0000000000
--- a/doc/install_gogs_from_source_on_ubuntu.md
+++ /dev/null
@@ -1,48 +0,0 @@
-##Install gogs under ubuntu 14.04 LTS 32bit from source code
-
-###Requirements
-- Go Programming Language: Version >= 1.2
-- git(bash): Version >= 1.6.6(both server and client)
-- MySQL: Version >= 5.1 or PostgreSQL or NOTHING.
-
-### Create the user which will run git
-- sudo adduser git
-- su git
-
-### Install git and Mysql-server
-- sudo apt-get install git
-- sudo apt-get install mysql-server
-
-### Create database
-- $ mysql -u root -p
-- mysql> SET GLOBAL storage_engine = 'InnoDB';
-- mysql> CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_bin;
-- mysql> GRANT ALL PRIVILEGES ON gogs.* TO 'root'@'localhost' IDENTIFIED BY 'pasword';
-- mysql> FLUSH PRIVILEGES;
-- mysql> QUIT
-
-### install go from source
-- sudo apt-get install build-essential
-- sudo apt-get install mercurial
-- hg clone -r release https://go.googlecode.com/hg/ /home/git/golang/
-
-
-- echo export GOROOT=/home/git/golang >>.bashrc
-- echo export GOARCH=386 >>.bashrc
-- echo export GOOS=linux >>.bashrc
-- echo export GOBIN= /home/git/golang/bin >>.bashrc
-- echo export GOPATH=$HOME/app/Go >>.bashrc
-- echo PATH=${PATH}: /$HOME/golang/bin >>.bashrc
-- cd $GOROOT/src
-- ./make.bash
-
-### Download and install dependencies
-- $ go get -u github.com/gogits/gogs
-
-### Build main program
-- $ cd $GOPATH/src/github.com/gogits/gogs
-- $ go build
-- $ ./start.sh
-
-### At present, you could access gogs from http://localhost:3000
-
diff --git a/dockerfiles/build.sh.bak b/dockerfiles/build.sh.bak
deleted file mode 100755
index 272424c872..0000000000
--- a/dockerfiles/build.sh.bak
+++ /dev/null
@@ -1,29 +0,0 @@
-# Configs of the docker images, you might have specify your own configs here.
-# type of database, support 'mysql' and 'postgres'
-DB_TYPE="postgres"
-DB_PASSWORD="YOUR_DB_PASSWORD"
-DB_RUN_NAME="YOUR_DB_RUN_NAME"
-HOST_PORT="YOUR_HOST_PORT"
-
-# Replace the database root password in database image Dockerfile.
-sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
-# Replace the database root password in gogits image deploy.sh file.
-sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh
-# Replace the database type in gogits image deploy.sh file.
-sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh
-
-# Build the database image
-cd images/$DB_TYPE
-docker build -t gogs/$DB_TYPE .
-#
-## Build the gogits image
-cd ../gogits
-docker build -t gogs/gogits .
-#
-## Run MySQL image with name
-docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE
-#
-## Run gogits image and link it to the database image
-echo "Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:"
-echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m"
-
diff --git a/dockerfiles/images/gogits/Dockerfile b/dockerfiles/images/gogits/Dockerfile
index 7f1514efeb..1f67d41ed9 100644
--- a/dockerfiles/images/gogits/Dockerfile
+++ b/dockerfiles/images/gogits/Dockerfile
@@ -1,8 +1,6 @@
FROM stackbrew/ubuntu:13.10
MAINTAINER Meaglith Ma <genedna@gmail.com> (@genedna)
-ENV DEBIAN_FRONTEND noninteractive
-
#aliyun#RUN echo "deb http://mirrors.aliyun.com/ubuntu/ saucy main restricted" > /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-updates main restricted" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy universe" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-updates universe" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy multiverse" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-updates multiverse" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-backports main restricted universe multiverse" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-security main restricted" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-security universe" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-security multiverse" >> /etc/apt/sources.list
#nchc#RUN echo "deb http://free.nchc.org.tw/ubuntu/ saucy main restricted" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy main restricted" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-updates main restricted" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-updates main restricted" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy universe" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy universe" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-updates universe" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-updates universe" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy multiverse" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy multiverse" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-updates multiverse" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-updates multiverse" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-backports main restricted universe multiverse" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-backports main restricted universe multiverse" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-security main restricted" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-security main restricted" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-security universe" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-security universe" >> /etc/apt/source.list && echo "deb http://free.nchc.org.tw/ubuntu/ saucy-security multiverse" >> /etc/apt/source.list && echo "deb-src http://free.nchc.org.tw/ubuntu/ saucy-security multiverse" >> /etc/apt/source.list && echo "deb http://extras.ubuntu.com/ubuntu saucy main" >> /etc/apt/source.list && echo "deb-src http://extras.ubuntu.com/ubuntu saucy main" >> /etc/apt/source.list
diff --git a/dockerfiles/images/memcache/Dockerfile b/dockerfiles/images/memcache/Dockerfile
index 2466c1f5bb..a1a2b6ee41 100644
--- a/dockerfiles/images/memcache/Dockerfile
+++ b/dockerfiles/images/memcache/Dockerfile
@@ -3,8 +3,6 @@ FROM ubuntu
# Set the file maintainer (your name - the file's author)
MAINTAINER Borja Burgos <borja@tutum.co>
-ENV DEBIAN_FRONTEND noninteractive
-
# Update the default application repository sources list
RUN apt-get update
diff --git a/dockerfiles/images/mysql/Dockerfile b/dockerfiles/images/mysql/Dockerfile
index 8fff5a194c..a9a72e35c4 100644
--- a/dockerfiles/images/mysql/Dockerfile
+++ b/dockerfiles/images/mysql/Dockerfile
@@ -3,8 +3,6 @@
FROM stackbrew/ubuntu:saucy
MAINTAINER Meaglith Ma <genedna@gmail.com> (@genedna)
-ENV DEBIAN_FRONTEND noninteractive
-
RUN apt-get install -y --force-yes software-properties-common
RUN add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
RUN apt-get --yes --force-yes update
diff --git a/dockerfiles/images/postgres/Dockerfile b/dockerfiles/images/postgres/Dockerfile
index 0188dd78fb..9d76873c98 100644
--- a/dockerfiles/images/postgres/Dockerfile
+++ b/dockerfiles/images/postgres/Dockerfile
@@ -1,8 +1,6 @@
FROM ubuntu
MAINTAINER SvenDowideit@docker.com
-ENV DEBIAN_FRONTEND noninteractive
-
# Add the PostgreSQL PGP key to verify their Debian packages.
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
diff --git a/dockerfiles/images/redis/Dockerfile b/dockerfiles/images/redis/Dockerfile
index 93260ccaa1..a5b948fb14 100644
--- a/dockerfiles/images/redis/Dockerfile
+++ b/dockerfiles/images/redis/Dockerfile
@@ -1,8 +1,6 @@
FROM stackbrew/ubuntu:saucy
MAINTAINER Meaglith Ma <genedna@gmail.com> (@genedna), Lance Ju <juzhenatpku@gmail.com> (@crystaldust)
-ENV DEBIAN_FRONTEND noninteractive
-
RUN apt-get update && apt-get install -y redis-server
# Usually redis doesn't need a password
#RUN sed -i "s/# requirepass foobared/requirepass THE_REDIS_PASSWORD/g" /etc/redis/redis.conf
diff --git a/gogs.go b/gogs.go
index 7f7267ecd6..af707862ad 100644
--- a/gogs.go
+++ b/gogs.go
@@ -19,7 +19,7 @@ import (
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true
-const APP_VER = "0.3.1.0430 Alpha"
+const APP_VER = "0.3.1.0501 Alpha"
func init() {
base.AppVer = APP_VER
diff --git a/models/action.go b/models/action.go
index a9a41a9f4d..77576a995a 100644
--- a/models/action.go
+++ b/models/action.go
@@ -88,12 +88,6 @@ func CommitRepoAction(userId int64, userName, actEmail string,
return err
}
- if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
- OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
- log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
- return err
- }
-
// Change repository bare status and update last updated time.
repo, err := GetRepositoryByName(userId, repoName)
if err != nil {
@@ -106,12 +100,24 @@ func CommitRepoAction(userId int64, userName, actEmail string,
return err
}
+ if !repo.IsPrivate {
+ if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
+ OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
+ log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
+ return err
+ }
+ }
+
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
return nil
}
// NewRepoAction adds new action for creating repository.
func NewRepoAction(user *User, repo *Repository) (err error) {
+ if repo.IsPrivate {
+ return nil
+ }
+
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name}); err != nil {
log.Error("action.NewRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
@@ -124,6 +130,10 @@ func NewRepoAction(user *User, repo *Repository) (err error) {
// TransferRepoAction adds new action for transfering repository.
func TransferRepoAction(user, newUser *User, repo *Repository) (err error) {
+ if repo.IsPrivate {
+ return nil
+ }
+
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
OpType: OP_TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name}); err != nil {
log.Error("action.TransferRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
diff --git a/models/user.go b/models/user.go
index 6751d11d49..42b3ebe6ae 100644
--- a/models/user.go
+++ b/models/user.go
@@ -46,6 +46,7 @@ type User struct {
Id int64
LowerName string `xorm:"unique not null"`
Name string `xorm:"unique not null"`
+ FullName string
Email string `xorm:"unique not null"`
Passwd string `xorm:"not null"`
LoginType int
diff --git a/modules/auth/auth.go b/modules/auth/auth.go
index e493faefe7..96e3868ff6 100644
--- a/modules/auth/auth.go
+++ b/modules/auth/auth.go
@@ -21,7 +21,7 @@ type Form interface {
}
type RegisterForm struct {
- UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
+ UserName string `form:"username" binding:"Required;AlphaDashDot;MaxSize(30)"`
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
RetypePasswd string `form:"retypepasswd"`
@@ -123,6 +123,8 @@ func validate(errors *base.BindingErrors, data base.TmplData, form Form) {
data["ErrorMsg"] = form.Name(field.Name) + " cannot be empty"
case base.BindingAlphaDashError:
data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) characters"
+ case base.BindingAlphaDashDotError:
+ data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) or dot characters"
case base.BindingMinSizeError:
data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters"
case base.BindingMaxSizeError:
@@ -174,7 +176,7 @@ type InstallForm struct {
RunUser string `form:"run_user"`
Domain string `form:"domain"`
AppUrl string `form:"app_url"`
- AdminName string `form:"admin_name" binding:"Required"`
+ AdminName string `form:"admin_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
AdminPasswd string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(30)"`
AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
SmtpHost string `form:"smtp_host"`
diff --git a/modules/auth/user.go b/modules/auth/user.go
index 973894221d..8d60670db4 100644
--- a/modules/auth/user.go
+++ b/modules/auth/user.go
@@ -75,6 +75,7 @@ type FeedsForm struct {
type UpdateProfileForm struct {
UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
+ FullName string `form:"fullname" binding:"MaxSize(40)"`
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
Website string `form:"website" binding:"MaxSize(50)"`
Location string `form:"location" binding:"MaxSize(50)"`
diff --git a/modules/base/base.go b/modules/base/base.go
index 3e80a436e4..e6befb83fd 100644
--- a/modules/base/base.go
+++ b/modules/base/base.go
@@ -45,6 +45,7 @@ func (this *BindingErrors) Combine(other BindingErrors) {
const (
BindingRequireError string = "Required"
BindingAlphaDashError string = "AlphaDash"
+ BindingAlphaDashDotError string = "AlphaDashDot"
BindingMinSizeError string = "MinSize"
BindingMaxSizeError string = "MaxSize"
BindingEmailError string = "Email"
diff --git a/modules/middleware/binding.go b/modules/middleware/binding.go
index cde9ae9cc0..bff34ddde0 100644
--- a/modules/middleware/binding.go
+++ b/modules/middleware/binding.go
@@ -180,9 +180,10 @@ func Validate(obj interface{}) martini.Handler {
}
var (
- alphaDashPattern = regexp.MustCompile("[^\\d\\w-_]")
- emailPattern = regexp.MustCompile("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[a-zA-Z0-9](?:[\\w-]*[\\w])?")
- urlPattern = regexp.MustCompile(`(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?`)
+ alphaDashPattern = regexp.MustCompile("[^\\d\\w-_]")
+ alphaDashDotPattern = regexp.MustCompile("[^\\d\\w-_\\.]")
+ emailPattern = regexp.MustCompile("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[a-zA-Z0-9](?:[\\w-]*[\\w])?")
+ urlPattern = regexp.MustCompile(`(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?`)
)
func validateStruct(errors *base.BindingErrors, obj interface{}) {
@@ -227,6 +228,11 @@ func validateStruct(errors *base.BindingErrors, obj interface{}) {
errors.Fields[field.Name] = base.BindingAlphaDashError
break
}
+ case rule == "AlphaDashDot":
+ if alphaDashDotPattern.MatchString(fmt.Sprintf("%v", fieldValue)) {
+ errors.Fields[field.Name] = base.BindingAlphaDashDotError
+ break
+ }
case strings.HasPrefix(rule, "MinSize("):
min, err := strconv.Atoi(rule[8 : len(rule)-1])
if err != nil {
diff --git a/routers/dev/template.go b/routers/dev/template.go
index 63d5d9a5bb..7145bf51fa 100644
--- a/routers/dev/template.go
+++ b/routers/dev/template.go
@@ -21,5 +21,6 @@ func TemplatePreview(ctx *middleware.Context, params martini.Params) {
ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
ctx.Data["ActiveCodeLives"] = base.Service.ActiveCodeLives / 60
ctx.Data["ResetPwdCodeLives"] = base.Service.ResetPwdCodeLives / 60
+ ctx.Data["CurDbValue"] = ""
ctx.HTML(200, params["_1"])
}
diff --git a/routers/user/setting.go b/routers/user/setting.go
index a55e617f44..f62e931051 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -54,6 +54,7 @@ func SettingPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
user.Name = form.UserName
}
+ user.FullName = form.FullName
user.Email = form.Email
user.Website = form.Website
user.Location = form.Location
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index 23a1173f99..b3e3368b44 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -15,7 +15,7 @@
</div>
<div class="col-md-4">
- <p class="desc"><a href="http://gogits.org">Official Website</a></p>
+ <p class="desc"><a href="http://gogs.io">Official Website</a></p>
</div>
</div>
</div>
diff --git a/templates/base/navbar.tmpl b/templates/base/navbar.tmpl
index da6865b8e8..80085d974a 100644
--- a/templates/base/navbar.tmpl
+++ b/templates/base/navbar.tmpl
@@ -3,7 +3,7 @@
<nav class="nav">
<a id="nav-logo" class="nav-item pull-left{{if .PageIsHome}} active{{end}}" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="logo"></a>
<a class="nav-item pull-left{{if .PageIsUserDashboard}} active{{end}}" href="/">Dashboard</a>
- <a class="nav-item pull-left{{if .PageIsHelp}} active{{end}}" target="_blank" href="https://github.com/gogits/gogs/wiki">Help</a>{{if .IsSigned}}
+ <a class="nav-item pull-left{{if .PageIsHelp}} active{{end}}" target="_blank" href="http://gogs.io/docs">Help</a>{{if .IsSigned}}
{{if .HasAccess}}<form class="nav-item pull-left{{if .PageIsNewRepo}} active{{end}}" id="nav-search-form">
<div class="input-group">
<div class="input-group-btn">
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 15d2a0bd5a..43ecabfa16 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -6,6 +6,7 @@
<a href="http://gravatar.com/emails/" class="center-block" data-toggle="tooltip" data-placement="bottom" title="Change your avatar at gravatar.com">
<img id="user-avatar" src="{{.Owner.AvatarLink}}?s=200" alt="user-avatar" title="{{.Owner.Name}}"/>
</a>
+ {{if .Owner.FullName}}<span id="user-name" class="center-block">{{.Owner.FullName}}</span>{{end}}
<span id="user-name" class="center-block">{{.Owner.Name}}</span>
</div>
<div class="profile-info">
diff --git a/templates/user/setting.tmpl b/templates/user/setting.tmpl
index 56d859fe41..bdcf9ce3b7 100644
--- a/templates/user/setting.tmpl
+++ b/templates/user/setting.tmpl
@@ -18,6 +18,13 @@
</div>
<div class="form-group">
+ <label class="col-md-2 control-label">Full Name</label>
+ <div class="col-md-8">
+ <input name="fullname" class="form-control" placeholder="Type your full name" value="{{.SignedUser.FullName}}">
+ </div>
+ </div>
+
+ <div class="form-group">
<label class="col-md-2 control-label">Email<strong class="text-danger">*</strong></label>
<div class="col-md-8">
<input name="email" class="form-control" placeholder="Type your e-mail address" required="required" value="{{.SignedUser.Email}}">