summaryrefslogtreecommitdiff
path: root/src/application/actions/pwreset/get.php
blob: c66b28d9b3bd06ad1bf5fa8a0a4ffd6ab7f20f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

$token = $_GET["token"] ?? null;
$signature = $_GET["sig"] ?? null;

if ($token !== null && $signature !== null) {
    $resetUser = decodePasswordResetLink($db, $token, $signature);
    if ($resetUser === null) {
        http_response_code(400);
        msg_error(__("The password reset link is either invalid or it expired"), true);
        exit;
    }

    _view("template_start", [ "_title" => __("Reset password") ]);
    _view("template_navigation_start");
    _view("template_navigation_end");
    _view("form_new_password", [
        "token" => $token,
        "signature" => $signature,
    ]);
    _view("template_end", [...getThemeAndLangInfo()]);
} else {
    _view("template_start", [ "_title" => __("Reset password") ]);
    _view("template_navigation_start");
    _view("template_navigation", ["user" => null]);
    _view("template_navigation_end");
    _view("form_password_reset");
    _view("template_end", [...getThemeAndLangInfo()]);
}