PasswordGrantVerifierController::verify()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 2
crap 6
1
<?php
2
3
/*
4
 * This file is part of the HRis Software package.
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * Licensed under the 3-clause BSD License.
9
 *
10
 * This source file is subject to the 3-clause BSD License that is
11
 * bundled with this package in the LICENSE file.
12
 *
13
 * @version    alpha
14
 *
15
 * @author     Bertrand Kintanar <[email protected]>
16
 * @license    BSD License (3-clause)
17
 * @copyright  (c) 2014-2016, b8 Studios, Ltd
18
 *
19
 * @link       http://github.com/HB-Co/HRis
20
 */
21
22
namespace HRis\Api\Controllers\Auth\OAuth;
23
24
use Illuminate\Support\Facades\Auth;
25
use Irradiate\Api\Controllers\BaseController;
26
27
class PasswordGrantVerifierController extends BaseController
28
{
29
    /**
30
     * @param $username
31
     * @param $password
32
     *
33
     * @return bool
34
     *
35
     * @author Bertrand Kintanar <[email protected]>
36
     */
37
    public function verify($username, $password)
38
    {
39
        $credentials = [
40
            'email'    => $username,
41
            'password' => $password,
42
        ];
43
44
        if (Auth::once($credentials)) {
45
            return Auth::user()->id;
46
        }
47
48
        return false;
49
    }
50
}
51