diff --git a/src/bunker.go b/src/bunker.go index d767a2d..6ecca53 100644 --- a/src/bunker.go +++ b/src/bunker.go @@ -191,8 +191,8 @@ func (e mainEnv) setupRouter() *httprouter.Router { router.DELETE("/v1/user/:mode/:address", e.userDelete) router.PUT("/v1/user/:mode/:address", e.userChange) - router.GET("/v1/login/:mode/:address", e.userLogin) - router.GET("/v1/enter/:mode/:address/:tmp", e.userLoginEnter) + router.GET("/v1/prelogin/:mode/:address", e.userPrelogin) + router.GET("/v1/login/:mode/:address/:tmp", e.userLogin) router.POST("/v1/sharedrecord/token/:token", e.newSharedRecord) router.GET("/v1/get/:record", e.getRecord) diff --git a/src/users_api.go b/src/users_api.go index 9080171..58108da 100644 --- a/src/users_api.go +++ b/src/users_api.go @@ -275,10 +275,10 @@ func (e mainEnv) userDelete(w http.ResponseWriter, r *http.Request, ps httproute notifyForgetMe(notifyURL, resultJSON, "token", userTOKEN) } -func (e mainEnv) userLogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +func (e mainEnv) userPrelogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { address := ps.ByName("address") mode := ps.ByName("mode") - event := audit("user login by "+mode, address, mode, address) + event := audit("user prelogin by "+mode, address, mode, address) defer func() { event.submit(e.db) }() if mode != "phone" && mode != "email" { @@ -320,11 +320,11 @@ func (e mainEnv) userLogin(w http.ResponseWriter, r *http.Request, ps httprouter fmt.Fprintf(w, `{"status":"ok","result":"done"}`) } -func (e mainEnv) userLoginEnter(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +func (e mainEnv) userLogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { tmp := atoi(ps.ByName("tmp")) address := ps.ByName("address") mode := ps.ByName("mode") - event := audit("user login step 2 by "+mode, address, mode, address) + event := audit("user login by "+mode, address, mode, address) defer func() { event.submit(e.db) }() if mode != "phone" && mode != "email" { diff --git a/ui/index.html b/ui/index.html index 15c3d7e..29e4e4d 100644 --- a/ui/index.html +++ b/ui/index.html @@ -242,11 +242,11 @@ if (conf["custom_css_file"]) { xhr0.onload = function () { if (xhr0.status === 200) { var xhr = new XMLHttpRequest(); - var url = "/v1/login/email/" + encodeURI(key) + var url = "/v1/prelogin/email/" + encodeURI(key) xhr.open('GET', url); xhr.onload = function () { if (xhr.status === 200) { - document.location = "/site/enter.html"; + document.location = "/site/login.html"; } else if (conf["MagicLookup"]) { //error var loading = document.getElementById('loading'); @@ -269,10 +269,10 @@ if (conf["custom_css_file"]) { xhr0.onload = function () { if (xhr0.status === 200) { var xhr = new XMLHttpRequest(); - xhr.open('GET', "/v1/login/phone/" + encodeURI(key)); + xhr.open('GET', "/v1/prelogin/phone/" + encodeURI(key)); xhr.onload = function () { if (xhr.status === 200) { - document.location = "/site/enter.html"; + document.location = "/site/login.html"; } } xhr.send(); diff --git a/ui/site/enter.html b/ui/site/login.html similarity index 97% rename from ui/site/enter.html rename to ui/site/login.html index 392183d..874fe1d 100644 --- a/ui/site/enter.html +++ b/ui/site/login.html @@ -69,7 +69,7 @@ if (conf["custom_css_file"]) { var code = $('#codevalue').val(); var login = window.localStorage.getItem('login') if (login.indexOf('@') > 0) { - $.get("/v1/enter/email/" + encodeURI(login) + "/" + encodeURI(code), function (data) { + $.get("/v1/login/email/" + encodeURI(login) + "/" + encodeURI(code), function (data) { window.localStorage.setItem('login', ""); if (data.xtoken) { window.localStorage.setItem('xtoken', data.xtoken); @@ -80,7 +80,7 @@ if (conf["custom_css_file"]) { } }, "json"); } else { - $.get("/v1/enter/phone/" + encodeURI(login) + "/" + encodeURI(code), function (data) { + $.get("/v1/login/phone/" + encodeURI(login) + "/" + encodeURI(code), function (data) { window.localStorage.setItem('login', ""); if (data.xtoken) { window.localStorage.setItem('xtoken', data.xtoken);