test: password recovery
diff --git a/templates/email.php b/templates/email.php
new file mode 100644
index 0000000..f64db8c
--- /dev/null
+++ b/templates/email.php
@@ -0,0 +1,29 @@
+<?php
+$MAIL_TEMPLATE = (object)[
+ "subject" => "Confirm your email",
+ "text" => "To complete your registration please paste this to your browser: {{url}}",
+ "html" => "<html><body>
+ <h2>Almost there! Click on the link bellow to confirm your email address</h2>
+ <a href='{{url}}'>Confirm</a>
+ </body></html>"
+];
+
+
+$RECOVERY_EMAIL_TEMPLATE = (object)[
+ "subject" => "Change your password!",
+ "text" => "Seems you requested a password change. If that wasn't you please ignore this message. Otherwise go to this url to change your password: {{url}}",
+ "html" => "<html><body>
+ <h3>Seems you requested a password change. If that wasn't you please ignore this message. Otherwise go to this url to change your password</h3>
+ <a href='{{url}}'>Click here</a> to change your password
+ </body></html>"
+];
+
+
+// Add the support email there
+$PASSWORD_CHANGED_EMAIL_TEMPLATE = (object)[
+ "subject" => "Your password was changed",
+ "text" => "Your password was chanegd successfully. If this wasn't you please contact support",
+ "html" => "<html><body>
+ <h3>Your password was chanegd successfully. If this wasn't you please contact support</h3>
+ </body></html>"
+];
diff --git a/templates/recover_email_form.htm b/templates/recover_email_form.htm
new file mode 100644
index 0000000..a423568
--- /dev/null
+++ b/templates/recover_email_form.htm
@@ -0,0 +1,32 @@
+<h1>Change your password</h1>
+
+<form action="" method="POST">
+ <!-- Email input -->
+ <div class="form-outline mb-3">
+ <label class="form-label font-weight-bold" for="form3Example3">Email address*</label>
+ <input required name="email" type="email" id="form3Example3"
+ class="form-control <?php if(isset($error) && $error && !isset($_POST['email'])){echo 'border-danger';}?>"
+ placeholder="myemail@example.com"
+ value="<?php echo isset($_POST['email']) ? htmlspecialchars($_POST['email']) : '' ?>" />
+ </div>
+
+ <!--captcha here-->
+ <div class="form-outline mb-3">
+
+ <label class="form-label font-weight-bold" for="form3Example4">Captcha:</label>
+ <div class="container mb-2 offset-md-2">
+ <img id="captcha" src="<?php echo $BASE_URL.'/captcha.php?token='.$_SESSION['captcha_token']; ?>" />
+ <div id="reload_captcha">
+ <button id="reload" class="btn btn-outline-info" type="button"> <span class="glyphicon glyphicon-refresh"
+ aria-hidden="true"></span></button>
+ </div>
+ </div>
+ <input pattern="[^\s]{<?php echo $CAPTCHA_LENGTH; ?>,}" required title="Please fill the captcha. It has 5 characteres" name="captcha"
+ type="text" id="form3Example6" class="form-control" placeholder="Type what you see on the image above" />
+ </div>
+
+ <!-- Submit button -->
+ <button name="type" value="recover" type="submit" class="btn btn-primary float-right btn-md">Confirm</button>
+
+</form>
+</div>
diff --git a/templates/recover_new_password_form.htm b/templates/recover_new_password_form.htm
new file mode 100644
index 0000000..b83b8e8
--- /dev/null
+++ b/templates/recover_new_password_form.htm
@@ -0,0 +1,27 @@
+<h2>Renewing: <?php echo $email;?></h2>
+
+<form action="" method="POST">
+ <!-- Password input -->
+ <div class="form-outline mb-3">
+ <label class="form-label font-weight-bold" for="form3Example4">Password*</label>
+ <input pattern="[^\s]{<?php echo $VAL_USER->min_password.','.$VAL_USER->max_password;?>}" required title="At least 8 not whitespace characteres" name="password"
+ type="password" id="form3Example4"
+ class="form-control <?php if(isset($error) && $error && !isset($_POST['password'])){echo 'border-danger';}?>"
+ placeholder="********"
+ value="<?php echo isset($_POST['password']) ? htmlspecialchars($_POST['password']) : '' ?>" />
+ </div>
+ <!-- Password input -->
+ <div class="form-outline mb-3">
+ <label class="form-label font-weight-bold" for="form3Example4">Confirm your Password*</label>
+ <input pattern="[^\s]{<?php echo $VAL_USER->min_password.','.$VAL_USER->max_password;?>}" required title="At least 8 not whitespace characteres" name="password_confirm"
+ type="password" id="form3Example5"
+ class="form-control <?php if(isset($error) && $error && !isset($_POST['password_confirm'])){echo 'border-danger';}?>"
+ placeholder="********"
+ value="<?php echo isset($_POST['password_confirm']) ? htmlspecialchars($_POST['password_confirm']) : '' ?>" />
+ </div>
+
+ <!-- Submit button -->
+ <button name="type" value="password_change" type="submit" class="btn btn-primary float-right btn-md">Confirm</button>
+
+</form>
+</div>
diff --git a/templates/recover_success.htm b/templates/recover_success.htm
new file mode 100644
index 0000000..b1d2784
--- /dev/null
+++ b/templates/recover_success.htm
@@ -0,0 +1 @@
+<div class="alert alert-success" role="alert">Your password was changed successfully!</div>
diff --git a/templates/strings.php b/templates/strings.php
index 6133ccc..557a60f 100644
--- a/templates/strings.php
+++ b/templates/strings.php
@@ -48,6 +48,9 @@
$STRINGS = (object)[
"email_confirmation" => "<h1>Email Confirmation</h1>",
"reloading_captcha" => "Loading...",
+ "wrong_captcha" => "Wrong captcha!<br>",
+ "recover_email_not_registered" => "This email is not registered<br>",
+ "change_password_ldap_error" => "<h2>Something went wrong.</h2>",
];
?>