1 | <?php |
||
13 | class Oauth |
||
14 | { |
||
15 | /** |
||
16 | * This method register a new user. |
||
17 | * |
||
18 | * @param $request |
||
19 | * @param $response |
||
20 | * |
||
21 | * @return json response |
||
22 | */ |
||
23 | public function registerUser(Request $request, Response $response) |
||
50 | |||
51 | /** |
||
52 | * This method creates user. |
||
53 | * |
||
54 | * @param $user |
||
55 | * @param $userParams |
||
56 | * @param $response |
||
57 | * |
||
58 | * @return json $response |
||
59 | */ |
||
60 | public function runRegisterUser($user, $userParams, $response) |
||
78 | |||
79 | /** |
||
80 | * This method authenticate the user and log them in if the supplied |
||
81 | * credentials are valid. |
||
82 | * |
||
83 | * @return json jwt |
||
84 | */ |
||
85 | public function loginUser(Request $request, Response $response) |
||
107 | |||
108 | /** |
||
109 | * This method logout the user. |
||
110 | * |
||
111 | * @param $args logout |
||
112 | * |
||
113 | * @return $response |
||
|
|||
114 | */ |
||
115 | public function logoutUser(Request $request, Response $response, $args) |
||
119 | |||
120 | /** |
||
121 | * This method verifies a registered user. |
||
122 | * |
||
123 | * @param $email |
||
124 | * @param $username |
||
125 | * |
||
126 | * @return bool true |
||
127 | */ |
||
128 | public function verifyUserRegistration($username, $email) |
||
129 | { |
||
130 | if (isset($username, $email)) { |
||
131 | $userFound = Capsule::table('users') |
||
132 | ->Where('username', '=', strtolower($username)) |
||
133 | ->orWhere('email', '=', strtolower($email)) |
||
134 | ->get(); |
||
135 | |||
136 | if (count($userFound) > 0) { |
||
137 | return true; |
||
138 | } |
||
139 | } |
||
140 | |||
141 | return false; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * This method builds an access token for a login user;. |
||
146 | * |
||
147 | * @param $userData |
||
148 | * |
||
149 | * @return string $token |
||
150 | */ |
||
151 | public function buildAcessToken(array $userData) |
||
185 | } |
||
186 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.