Completed
Push — master ( 047121...54c8bf )
by Patrick
02:58 queued 01:25
created

change.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
ini_set('display_errors', 1);
3
error_reporting(E_ALL);
4
5 View Code Duplication
if(strpos($_SERVER['REQUEST_URI'], '//') !== false)
6
{
7
    $uri = str_replace('//', '/', $_SERVER['REQUEST_URI']);
8
    header("Location: https://".$_SERVER["HTTP_HOST"].$uri);
9
    exit();
10
}
11
12
require_once('class.ProfilesPage.php');
13
$page = new ProfilesPage('Burning Flipside Password Change');
14
$auth = AuthProvider::getInstance();
15
$require_current_pass = true;
16
$user = $page->user;
0 ignored issues
show
The property user does not seem to exist in ProfilesPage.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
17
if($user === false || $user === null)
18
{
19
    //We might be reseting a user's forgotten password...
20
    if(isset($_GET['hash']))
21
    {
22
        $user = $auth->getUserByResetHash($_GET['hash']);
23
        $require_current_pass = false;
24
    }
25
}
26
27
if($user === false || $user === null)
28
{
29
    if(isset($_GET['hash']))
30
    {
31
        $page->addNotification('This reset hash is no longer valid. Please select the neweset reset link in your email', FlipPage::NOTIFICATION_FAILED);
32
    }
33
    else
34
    {
35
        $page->addNotification('Please Log in first!', FlipPage::NOTIFICATION_FAILED);
36
    }
37
}
38
else
39
{
40
    $page->addJS('js/zxcvbn-async.js');
41
    $current = '';
42
    if($require_current_pass)
43
    {
44
        $current = '<div class="form-group"><input class="form-control" type="password" id="current" name="current" placeholder="Current Password" required autofocus/></div>';
45
    }
46
    else
47
    {
48
        $current = '<input type="hidden" id="hash" name="hash" value="'.$_GET['hash'].'"/>';
49
    }
50
    $page->body = '
51
        <div id="content" class="container">
52
            <h3>Burning Flipside Password Change</h3>
53
            <form name="form" id="form" role="form">
54
                '.$current.'
55
                <div class="form-group"><input class="form-control" type="password" id="password" name="password" placeholder="New Password" required/></div>
56
                <div class="form-group"><input class="form-control" type="password" id="password2" name="password2" placeholder="Confirm Password" required/></div>
57
                <button class="btn btn-lg btn-primary btn-block" type="submit">Change Password</button>
58
            </form>
59
        </div>';
60
}
61
$page->printPage();
62
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
63
64
65