認証って更新済

このコミットが含まれているのは:
テクニカル諏訪子 2019-04-30 15:04:43 +09:00
コミット 5948c206e8
1個のファイルの変更9行の追加14行の削除

ファイルの表示

@ -19,33 +19,32 @@ class AuthController extends Controller {
}
public function checkSelf(Request $request) { // /api/auth/checkself
$check = $this->checkLegit($request->username, $request->password);
$check = $this->checkLegit($request->kero_token);
return array($check);
}
public function checkLegit($u, $p) {
if (!isset($u) || !isset($p)) {
public function checkLegit($t) {
if (!isset($t)) {
return 0;
}
$check = DB::table('users')
->select('id')
->where('username', $u)
->where('password', $p)
->where('kero_token', $t)
->first();
return $check->id;
}
public function getPerms(Request $request) { // /api/auth/getpermissions
$check = $this->getPermissions($request->username, $request->password);
$check = $this->getPermissions($request->kero_token);
return array($check);
}
public function getPermissions($user, $pass) {
$check = $this->checkLegit($user, $pass);
public function getPermissions($token) {
$check = $this->checkLegit($token);
$perm = DB::table('usr_perm_id')
->select('perm_id')
@ -415,9 +414,6 @@ class AuthController extends Controller {
return array(
'uid' => $checkName->id,
'username' => $checkName->username,
'rawPassword' => $request->password,
'password' => $checkPass,
'kero_token' => $checkName->kero_token
);
}
@ -576,9 +572,8 @@ class AuthController extends Controller {
public function checkAuth(Request $request) {
$get = DB::table('users')
->select('id', 'username', 'password', 'kero_token')
->where('username', $request->username)
->where('password', $request->password)
->select('id', 'kero_token')
->where('kero_token', $request->kero_token)
->first();
$get = json_decode(json_encode($get), true);