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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
{ {
"colon": "",
"wide": "Wide", "wide": "Wide",
"isDelete": "己删除否?", "isDelete": "己删除否?",
"cancel": "取消", "cancel": "取消",
@ -108,7 +109,6 @@
"test": "測試", "test": "測試",
"sign_up": "註冊", "sign_up": "註冊",
"team": "團隊", "team": "團隊",
"colon": "",
"sing_up_error": "註冊失敗", "sing_up_error": "註冊失敗",
"user_name_ruler": "用戶名只能由az, AZ, 0-9, _ 組成長度為16", "user_name_ruler": "用戶名只能由az, AZ, 0-9, _ 組成長度為16",
"password_no_match": "密碼輸入不一致" "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) wideSession := session.WideSessions.New(httpSession)
username := httpSession.Values["username"].(string) 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) wideSessions := session.WideSessions.GetByUsername(username)
userConf := conf.Wide.GetUser(username) userConf := conf.Wide.GetUser(username)

View File

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

View File

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

View File

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