aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2012-01-05 22:16:26 +0100
committerKevin Chabowski <kevin@kch42.de>2012-01-05 22:16:26 +0100
commit572df2a7be46b7bdeaf10ad7568a43bb288e2500 (patch)
tree6100dd87346920f1371ed044084c2191117717ca
parenta11514dda8e0f631a234fc512b936bf90d19c304 (diff)
downloadr7r-repo-572df2a7be46b7bdeaf10ad7568a43bb288e2500.tar.gz
r7r-repo-572df2a7be46b7bdeaf10ad7568a43bb288e2500.tar.bz2
r7r-repo-572df2a7be46b7bdeaf10ad7568a43bb288e2500.zip
account implemented
-rw-r--r--r7r_repo/main.php25
-rw-r--r--r7r_repo/templates/src/account.html12
2 files changed, 37 insertions, 0 deletions
diff --git a/r7r_repo/main.php b/r7r_repo/main.php
index 8e52af0..d28cb44 100644
--- a/r7r_repo/main.php
+++ b/r7r_repo/main.php
@@ -337,6 +337,31 @@ $url_handlers = array(
echo $ste->exectemplate("admin.html");
},
+ "account" => function(&$data, $url_now, &$url_next)
+ {
+ global $ste, $user;
+
+ if($user === NULL)
+ throw new NotFoundError();
+
+ $url_next = array();
+ $ste->vars["menu"] = "account";
+ $ste->vars["title"] = "My Account";
+
+ if(isset($_POST["set_new_password"]))
+ {
+ if(empty($_POST["new_password"]))
+ $ste->vars["error"] = "Password must not be empty.";
+ else
+ {
+ $user->pwhash = PasswordHash::create($_POST["new_password"]);
+ $user->save();
+ $ste->vars["success"] = "Password set.";
+ }
+ }
+
+ echo $ste->exectemplate("account.html");
+ },
"setup" => function(&$data, $url_now, &$url_next)
{
global $settings, $ste;
diff --git a/r7r_repo/templates/src/account.html b/r7r_repo/templates/src/account.html
new file mode 100644
index 0000000..0aabf67
--- /dev/null
+++ b/r7r_repo/templates/src/account.html
@@ -0,0 +1,12 @@
+<ste:load name="master.html" />
+<ste:block name="content">
+ <ste:default_error />
+ <ste:default_success />
+
+ <form action="$rel_path_to_root/account" method="POST" accept-charset="UTF-8">
+ <h2>Change Password</h2>
+
+ <strong>New password:</strong> <input type="password" name="new_password" />
+ <input type="submit" name="set_new_password" />
+ </form>
+</ste:block>