ケロトーケンは登場!!

このコミットが含まれているのは:
テクニカル諏訪子 2019-04-03 23:33:19 +09:00
コミット 86f6e020fa
1個のファイルの変更28行の追加3行の削除

ファイルの表示

@ -304,7 +304,8 @@ class AuthController extends Controller {
'email' => $request->email,
'password' => $passwd,
'salt' => $salt,
'remember_token' => ''
'remember_token' => '',
'kero_token' => $this->makeToken()
]);
DB::table('usr_details')
@ -390,6 +391,7 @@ class AuthController extends Controller {
'id',
'username',
'password',
'kero_token',
'salt'
);
@ -401,11 +403,22 @@ class AuthController extends Controller {
}
if (hash_equals($checkPass, $checkName->password)) {
if (!$checkName->kero_token) {
$checkName->kero_token = $this->makeToken();
DB::table('users')
->where('id', $checkName->id)
->update([
'kero_token' => $checkName->kero_token
]);
}
return array(
'uid' => $checkName->id,
'username' => $checkName->username,
'rawPassword' => $request->password,
'password' => $checkPass
'password' => $checkPass,
'kero_token' => $checkName->kero_token
);
}
return array('err' => 'パスワードが違う');
@ -414,6 +427,18 @@ class AuthController extends Controller {
return array('err' => 'フォームは空いた');
}
function makeToken() {
$c = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$!%&()';
$clen = strlen($c);
$token = '';
for ($i = 0; $i < 128; $i++) {
$token .= $c[rand(0, $clen - 1)];
}
return $token;
}
function CheckEmail($email) {
$get = DB::table('users')
->where('email', $email)
@ -551,7 +576,7 @@ class AuthController extends Controller {
public function checkAuth(Request $request) {
$get = DB::table('users')
->select('id', 'username', 'password')
->select('id', 'username', 'password', 'kero_token')
->where('username', $request->username)
->where('password', $request->password)
->first();