認証って更新済
このコミットが含まれているのは:
コミット
5948c206e8
|
@ -19,33 +19,32 @@ class AuthController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkSelf(Request $request) { // /api/auth/checkself
|
public function checkSelf(Request $request) { // /api/auth/checkself
|
||||||
$check = $this->checkLegit($request->username, $request->password);
|
$check = $this->checkLegit($request->kero_token);
|
||||||
|
|
||||||
return array($check);
|
return array($check);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkLegit($u, $p) {
|
public function checkLegit($t) {
|
||||||
if (!isset($u) || !isset($p)) {
|
if (!isset($t)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$check = DB::table('users')
|
$check = DB::table('users')
|
||||||
->select('id')
|
->select('id')
|
||||||
->where('username', $u)
|
->where('kero_token', $t)
|
||||||
->where('password', $p)
|
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
return $check->id;
|
return $check->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPerms(Request $request) { // /api/auth/getpermissions
|
public function getPerms(Request $request) { // /api/auth/getpermissions
|
||||||
$check = $this->getPermissions($request->username, $request->password);
|
$check = $this->getPermissions($request->kero_token);
|
||||||
|
|
||||||
return array($check);
|
return array($check);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPermissions($user, $pass) {
|
public function getPermissions($token) {
|
||||||
$check = $this->checkLegit($user, $pass);
|
$check = $this->checkLegit($token);
|
||||||
|
|
||||||
$perm = DB::table('usr_perm_id')
|
$perm = DB::table('usr_perm_id')
|
||||||
->select('perm_id')
|
->select('perm_id')
|
||||||
|
@ -415,9 +414,6 @@ class AuthController extends Controller {
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'uid' => $checkName->id,
|
'uid' => $checkName->id,
|
||||||
'username' => $checkName->username,
|
|
||||||
'rawPassword' => $request->password,
|
|
||||||
'password' => $checkPass,
|
|
||||||
'kero_token' => $checkName->kero_token
|
'kero_token' => $checkName->kero_token
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -576,9 +572,8 @@ class AuthController extends Controller {
|
||||||
|
|
||||||
public function checkAuth(Request $request) {
|
public function checkAuth(Request $request) {
|
||||||
$get = DB::table('users')
|
$get = DB::table('users')
|
||||||
->select('id', 'username', 'password', 'kero_token')
|
->select('id', 'kero_token')
|
||||||
->where('username', $request->username)
|
->where('kero_token', $request->kero_token)
|
||||||
->where('password', $request->password)
|
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$get = json_decode(json_encode($get), true);
|
$get = json_decode(json_encode($get), true);
|
||||||
|
|
新しいイシューから参照