diff --git a/main.go b/main.go
index d808ea3..5553690 100644
--- a/main.go
+++ b/main.go
@@ -22,7 +22,7 @@ import (
const VERSION = "v10";
const LISTEN_HOST = "0.0.0.0";
-const DB_SCHEMA = 12
+const DB_SCHEMA = 13
var (
flagPort int
@@ -64,22 +64,23 @@ func main() {// {{{
go connectionManager.BroadcastLoop()
static = http.FileServer(http.Dir(config.Application.Directories.Static))
- http.HandleFunc("/css_updated", cssUpdateHandler)
- http.HandleFunc("/session/create", sessionCreate)
- http.HandleFunc("/session/retrieve", sessionRetrieve)
+ http.HandleFunc("/css_updated", cssUpdateHandler)
+ http.HandleFunc("/session/create", sessionCreate)
+ http.HandleFunc("/session/retrieve", sessionRetrieve)
http.HandleFunc("/session/authenticate", sessionAuthenticate)
- http.HandleFunc("/node/tree", nodeTree)
- http.HandleFunc("/node/retrieve", nodeRetrieve)
- http.HandleFunc("/node/create", nodeCreate)
- http.HandleFunc("/node/update", nodeUpdate)
- http.HandleFunc("/node/rename", nodeRename)
- http.HandleFunc("/node/delete", nodeDelete)
- http.HandleFunc("/node/upload", nodeUpload)
- http.HandleFunc("/node/download", nodeDownload)
- http.HandleFunc("/node/search", nodeSearch)
- http.HandleFunc("/key/retrieve", keyRetrieve)
- http.HandleFunc("/key/create", keyCreate)
- http.HandleFunc("/key/counter", keyCounter)
+ http.HandleFunc("/user/password", userPassword)
+ http.HandleFunc("/node/tree", nodeTree)
+ http.HandleFunc("/node/retrieve", nodeRetrieve)
+ http.HandleFunc("/node/create", nodeCreate)
+ http.HandleFunc("/node/update", nodeUpdate)
+ http.HandleFunc("/node/rename", nodeRename)
+ http.HandleFunc("/node/delete", nodeDelete)
+ http.HandleFunc("/node/upload", nodeUpload)
+ http.HandleFunc("/node/download", nodeDownload)
+ http.HandleFunc("/node/search", nodeSearch)
+ http.HandleFunc("/key/retrieve", keyRetrieve)
+ http.HandleFunc("/key/create", keyCreate)
+ http.HandleFunc("/key/counter", keyCounter)
http.HandleFunc("/ws", websocketHandler)
http.HandleFunc("/", staticHandler)
@@ -201,6 +202,37 @@ func sessionAuthenticate(w http.ResponseWriter, r *http.Request) {// {{{
})
}// }}}
+func userPassword(w http.ResponseWriter, r *http.Request) {// {{{
+ var err error
+ var ok bool
+ var session Session
+
+ if session, _, err = ValidateSession(r, true); err != nil {
+ responseError(w, err)
+ return
+ }
+
+ req := struct {
+ CurrentPassword string
+ NewPassword string
+ }{}
+ if err = parseRequest(r, &req); err != nil {
+ responseError(w, err)
+ return
+ }
+
+ ok, err = session.UpdatePassword(req.CurrentPassword, req.NewPassword)
+ if err != nil {
+ responseError(w, err)
+ return
+ }
+
+ responseData(w, map[string]interface{}{
+ "OK": true,
+ "CurrentPasswordOK": ok,
+ })
+}// }}}
+
func nodeTree(w http.ResponseWriter, r *http.Request) {// {{{
var err error
var session Session
diff --git a/static/css/main.css b/static/css/main.css
index d025926..a92b7c7 100644
--- a/static/css/main.css
+++ b/static/css/main.css
@@ -541,6 +541,19 @@ header .menu {
#app.node.toggle-tree #tree {
display: none;
}
+#profile-settings {
+ color: #333;
+ padding: 16px;
+}
+#profile-settings .passwords {
+ display: grid;
+ grid-template-columns: min-content 200px;
+ grid-gap: 8px 16px;
+ margin-bottom: 16px;
+}
+#profile-settings .passwords div {
+ white-space: nowrap;
+}
@media only screen and (max-width: 932px) {
#app.node {
grid-template-areas: "header" "crumbs" "child-nodes" "name" "content" "files" "blank";
diff --git a/static/js/node.mjs b/static/js/node.mjs
index 282614c..a6f2d25 100644
--- a/static/js/node.mjs
+++ b/static/js/node.mjs
@@ -86,6 +86,10 @@ export class NodeUI extends Component {
page = html`<${Keys} nodeui=${this} />`
break
+ case 'profile-settings':
+ page = html`<${ProfileSettings} nodeui=${this} />`
+ break
+
case 'search':
page = html`<${Search} nodeui=${this} />`
break
@@ -100,9 +104,10 @@ export class NodeUI extends Component {