Code Duplication    Length = 20-21 lines in 2 locations

api/v1/users.php 2 locations

@@ 379-398 (lines=20) @@
376
    }
377
}
378
379
function reset_pass($uid)
380
{
381
    global $app;
382
    $auth = AuthProvider::getInstance();
383
    $users = $auth->getUsersByFilter(new \Data\Filter('uid eq '.$uid));
384
    if($users === false || !isset($users[0]))
385
    {
386
        $app->response->setStatus(404);
387
        return;
388
    }
389
    else
390
    {
391
        $email_msg = new PasswordResetEmail($users[0]);
392
        $email_provider = EmailProvider::getInstance();
393
        if($email_provider->sendEmail($email_msg) === false)
394
        {
395
            throw new \Exception('Unable to send email!');
396
        }
397
    }
398
}
399
400
function remind_uid()
401
{
@@ 400-420 (lines=21) @@
397
    }
398
}
399
400
function remind_uid()
401
{
402
    global $app;
403
    $email = $app->request->params('email');
404
    $auth = AuthProvider::getInstance();
405
    $users = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$email));
406
    if($users === false || !isset($users[0]))
407
    {
408
        $app->response->setStatus(404);
409
        return;
410
    }
411
    else
412
    {
413
        $email_msg = new UIDForgotEmail($users[0]);
414
        $email_provider = EmailProvider::getInstance();
415
        if($email_provider->sendEmail($email_msg) === false)
416
        {
417
            throw new \Exception('Unable to send email!');
418
        }
419
    }
420
}
421
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
422
?>
423