/signup
This commit is contained in:
Liang Ding 2014-10-30 18:21:44 +08:00
parent 748ee58316
commit 5b5581392d
8 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,5 @@
{
"colon": ": ",
"wide": "Wide",
"isDelete": "Delete",
"cancel": "Cancel",
@ -108,7 +109,6 @@
"test": "Test",
"sign_up": "Sign Up",
"team": "Team",
"colon": ": ",
"sing_up_error": "Sign Up Error",
"user_name_ruler": "Username only by az, AZ, 0-9, _ consisting of a length of 16",
"password_no_match": "Password doesn't match the confirmation"

View File

@ -1,4 +1,5 @@
{
"colon": "",
"wide": "Wide",
"isDelete": "削除",
"cancel": "取消",
@ -108,7 +109,6 @@
"test": "テスト",
"sign_up": "登録",
"team": "チーム",
"colon": "",
"sing_up_error": "登録に失敗しました",
"user_name_ruler": "16の長さからなる_ AZ、AZ、0-9、によってユーザ名のみ",
"password_no_match": "一貫性のないパスワード入力"

View File

@ -1,4 +1,5 @@
{
"colon": "",
"wide": "Wide",
"isDelete": "是否删除",
"cancel": "取消",
@ -108,7 +109,6 @@
"test": "测试",
"sign_up": "注册",
"team": "团队",
"colon": "",
"sing_up_error": "注册失败",
"user_name_ruler": "用户名只能由 a-z, A-Z, 0-9, _ 组成长度为16",
"password_no_match": "密码输入不一致"

View File

@ -1,4 +1,5 @@
{
"colon": "",
"wide": "Wide",
"isDelete": "己删除否?",
"cancel": "取消",
@ -108,7 +109,6 @@
"test": "測試",
"sign_up": "註冊",
"team": "團隊",
"colon": "",
"sing_up_error": "註冊失敗",
"user_name_ruler": "用戶名只能由az, AZ, 0-9, _ 組成長度為16",
"password_no_match": "密碼輸入不一致"

11
main.go
View File

@ -54,7 +54,16 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
wideSession := session.WideSessions.New(httpSession)
username := httpSession.Values["username"].(string)
locale := conf.Wide.GetUser(username).Locale
user := conf.Wide.GetUser(username)
if nil == user {
glog.Warningf("Not found user [%s]", username)
http.Redirect(w, r, "/login", http.StatusFound)
return
}
locale := user.Locale
wideSessions := session.WideSessions.GetByUsername(username)
userConf := conf.Wide.GetUser(username)

View File

@ -100,7 +100,8 @@ func SignUpUser(w http.ResponseWriter, r *http.Request) {
dir := filepath.Dir(firstUserWorkspace)
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(conf.Wide.Locale),
"locale": conf.Wide.Locale, "ver": conf.WideVersion, "dir": dir}
"locale": conf.Wide.Locale, "ver": conf.WideVersion, "dir": dir,
"pathSeparator": conf.PathSeparator}
t, err := template.ParseFiles("views/sign_up.html")

View File

@ -83,7 +83,7 @@
<span>{{.i18n.team}}</span>
<div class="frame">
<ul>
<li class="signup" onclick="wide.signup()">
<li class="signup" onclick="window.open('/signup')">
<span>{{.i18n.sign_up}}</span>
</li>
</ul>

View File

@ -31,7 +31,7 @@
<div id="msg" class="fn-none"></div>
<div class="dir">
Workspace
<div id="dir" data-dir="{{.dir}}{{.pathSeparator}}">{{.dir}}</div>
<div id="dir" data-dir="{{.dir}}{{.pathSeparator}}">{{.dir}}{{.pathSeparator}}</div>
</div>
<input id="username" placeholder="Username"/><br/>
<input id="password" type="password" placeholder="Password"/><br/>