frontend: add logout

This commit is contained in:
Adhityaa 2018-06-05 14:23:32 +05:30
parent 98422b2dae
commit ee65be7bac
4 changed files with 21 additions and 1 deletions

View File

@ -63,6 +63,7 @@ func initStaticRouter(router *mux.Router) error {
"login", "login",
"signup", "signup",
"dashboard", "dashboard",
"logout",
"account", "account",
} }

View File

@ -1,7 +1,7 @@
SHELL = bash SHELL = bash
# list of JS files to be built # list of JS files to be built
JS_BUILD = jquery.js vue.js highlight.js chartist.js login.js signup.js dashboard.js JS_BUILD = jquery.js vue.js highlight.js chartist.js login.js signup.js dashboard.js logout.js
jquery.js = jquery.js jquery.js = jquery.js
vue.js = vue.js vue.js = vue.js
@ -10,6 +10,7 @@ chartist.js = chartist.js
login.js = utils.js http.js auth-common.js login.js login.js = utils.js http.js auth-common.js login.js
signup.js = utils.js http.js auth-common.js signup.js signup.js = utils.js http.js auth-common.js signup.js
dashboard.js = utils.js http.js errors.js self.js dashboard.js dashboard-setting.js dashboard-domain.js dashboard-installation.js dashboard-general.js dashboard-moderation.js dashboard-statistics.js dashboard-import.js dashboard-danger.js dashboard.js = utils.js http.js errors.js self.js dashboard.js dashboard-setting.js dashboard-domain.js dashboard-installation.js dashboard-general.js dashboard-moderation.js dashboard-statistics.js dashboard-import.js dashboard-danger.js
logout.js = utils.js logout.js
# for each file in $(JS_BUILD), list its composition # for each file in $(JS_BUILD), list its composition

8
frontend/js/logout.js Normal file
View File

@ -0,0 +1,8 @@
(function (global, document) {
global.logout = function() {
global.cookieSet("session", "");
document.location = "/login";
}
} (window, document));

10
frontend/logout.html Normal file
View File

@ -0,0 +1,10 @@
<html>
<head>
<script src="<<<.CdnPrefix>>>/js/jquery.js"></script>
<script src="<<<.CdnPrefix>>>/js/logout.js"></script>
</head>
<script>
window.onload = window.logout;
</script>
</html>