diff --git a/Localisation/en-GB.yaml b/Localisation/en-GB.yaml index 4dcb588..794e447 100644 --- a/Localisation/en-GB.yaml +++ b/Localisation/en-GB.yaml @@ -18,6 +18,8 @@ Bars: Bars ################################################## # C ################################################## +Change Password: Change Password +Confirm New Password: Confirm New Password Confirm Password: Confirm Password Copyright: Copyright Create an Account: Create an Account @@ -93,6 +95,7 @@ Logout: Logout ################################################## # N ################################################## +New Password: New Password Number of Parts: Number of Parts diff --git a/Pages/change-password.php b/Pages/change-password.php new file mode 100644 index 0000000..6724e98 --- /dev/null +++ b/Pages/change-password.php @@ -0,0 +1,10 @@ +RunUpdate( + queryBuilder: SQLQueryBuilderWrapper::UPDATE( + table: 'Users', + ) + ->set(col: 'PasswordHash', value: ':__password_hash__') + ->where('ID=:__user_id__') + ->bindValue(name: '__user_id__', value: SessionWrapper::Get(SessionElement::USER_ID)) + ->bindValue(name: '__password_hash__', value: $hashedPassword) +); + +header("Location: /profile"); +die(); diff --git a/Routing/Router.php b/Routing/Router.php index 7586fde..0836024 100644 --- a/Routing/Router.php +++ b/Routing/Router.php @@ -30,6 +30,9 @@ switch($requestElements[0]) case "logout": require_once __DIR__ . '/../Pages/logout.php'; return true; + case "change-password": + require_once __DIR__ . '/../Pages/change-password.php'; + return true; case "profile": require_once __DIR__ . '/../Pages/profile.php'; return true; diff --git a/Templates/Pages/change-password.html.twig b/Templates/Pages/change-password.html.twig new file mode 100644 index 0000000..9d25ee5 --- /dev/null +++ b/Templates/Pages/change-password.html.twig @@ -0,0 +1,39 @@ +{% extends "/Bases/StandardWebPage.html.twig" %} + +{% block content %} + + + + + +
+

{{ "Change Password"|translate }}

+
+ + +
+ + +
+ + +
+ + +
+ + +
+
+{% endblock %} \ No newline at end of file diff --git a/Templates/Pages/profile.html.twig b/Templates/Pages/profile.html.twig index 7c2c416..5fa1694 100644 --- a/Templates/Pages/profile.html.twig +++ b/Templates/Pages/profile.html.twig @@ -5,6 +5,7 @@

{{ "Your Profile"|translate }}

{{ "Logout"|translate }} + {{ "Change Password"|translate }}

{{ "Summary"|translate }}