$ git clone http://ion.nu/git/webchat
commit a2feeb7bb3ea69aedb0d6882365529f31c3e5ea9
Author: Alicia <...>
Date:   Thu Dec 31 00:25:04 2015 +0100

    Added interfaces for changing account password

diff --git a/chat.php b/chat.php
index cda80d4..918f68d 100644
--- a/chat.php
+++ b/chat.php
@@ -27,13 +27,13 @@
         <button onclick="showfullscreen('createaccount', 'createaccount_user');">Create account</button>
       </div>
       <div id="loggedin">
-        <button onclick="connection.send('logout');">Log out</button><br />
+        <button onclick="connection.send('logout');">Log out</button>
+        <button onclick="var p=prompt('New account password?');if(p)connection.send('setuserpass:'+p);">Change password</button><br />
         <button onclick="connection.send('registerchannel');" id="registerchannel">Register channel</button>
         <button onclick="setupmodmanager(); showfullscreen('managemods', false);" id="managemods_button">Manage moderators</button>
         <button onclick="setupbanlist(); showfullscreen('banlist', false);" id="banlist_button">Banlist</button>
         <button onclick="var p=prompt('New channel password? (empty for no password)');if(p)connection.send('setchanpass:'+p);" id="setchanpass_button">Set channel password</button>
         <br />
-        <!-- TODO: more account stuff? changing password -->
       </div>
       <button onclick="broadcast();" id="broadcastbutton">Broadcast</button><br />
       <input type="color" id="color" onchange="setcolor(this.value);" value="#000000" />
diff --git a/src/chat.c b/src/chat.c
index ea02715..373fc5f 100644
--- a/src/chat.c
+++ b/src/chat.c
@@ -590,6 +590,18 @@ printf("Got data from user %u (length: %llu, opcode %u): '%s'\n", i, head.length
             websock_write(users[i]->socket, "err:Failed to save password, the change will be temporary", 57, WEBSOCK_TEXT, use_tls);
           }
         }
+        else if(!strncmp(data, "setuserpass:", 12))
+        {
+          if(!users[i]->account)
+          {
+            websock_write(users[i]->socket, "err:You are not logged in", 25, WEBSOCK_TEXT, use_tls);
+            continue;
+          }
+          if(!db_setuserpassword(users[i]->account, &data[12]))
+          {
+            websock_write(users[i]->socket, "err:Failed to save password", 27, WEBSOCK_TEXT, use_tls);
+          }
+        }
       }
       else if(head.opcode==WEBSOCK_BINARY)
       {