Merge branch 'master' into compilation

This commit is contained in:
An Phan 2016-05-08 17:52:51 +08:00
commit 22b228f338
5 changed files with 11 additions and 10 deletions

View file

@ -19,7 +19,7 @@ class Application extends IlluminateApplication
*
* @link https://github.com/phanan/koel/releases
*/
const VERSION = 'v2.3.0';
const VERSION = 'v2.2.1';
/**
* We have merged public path and base path.

View file

@ -7,6 +7,7 @@ use App\Http\Requests\API\UserLoginRequest;
use App\Http\Requests\API\UserStoreRequest;
use App\Http\Requests\API\UserUpdateRequest;
use App\Models\User;
use Exception;
use Hash;
use JWTAuth;
use Log;
@ -43,12 +44,12 @@ class UserController extends Controller
*/
public function logout()
{
try {
JWTAuth::invalidate(JWTAuth::getToken());
} catch (JWTException $e) {
Log:error($e);
return response()->json(['error' => 'could_not_invalidate_token'], 500);
if ($token = JWTAuth::getToken()) {
try {
JWTAuth::invalidate($token);
} catch (Exception $e) {
Log::error($e);
}
}
return response()->json();

View file

@ -12,6 +12,7 @@ Route::get('/♫', function () {
Route::group(['prefix' => 'api', 'namespace' => 'API'], function () {
Route::post('me', 'UserController@login');
Route::delete('me', 'UserController@logout');
Route::group(['middleware' => 'jwt.auth'], function () {
Route::get('/', function () {
@ -40,7 +41,6 @@ Route::group(['prefix' => 'api', 'namespace' => 'API'], function () {
Route::resource('user', 'UserController', ['only' => ['store', 'update', 'destroy']]);
Route::put('me', 'UserController@updateProfile');
Route::delete('me', 'UserController@logout');
Route::get('lastfm/connect', 'LastfmController@connect');
Route::post('lastfm/session-key', 'LastfmController@setSessionKey');

View file

@ -36,7 +36,7 @@
"mocha": "^2.3.4",
"node-sass": "^3.4.2",
"nprogress": "^0.2.0",
"plyr": "^1.5.16",
"plyr": "1.5.x",
"rangeslider.js": "^2.1.1",
"rangetouch": "0.0.9",
"sinon": "^1.17.2",

View file

@ -22,7 +22,7 @@ Vue.http.interceptors.push({
NProgress.done();
if (r.status === 400 || r.status === 401) {
if (r.request.method !== 'POST' && r.request.url !== 'me') {
if (!(r.request.method === 'POST' && r.request.url === 'me')) {
// This is not a failed login. Log out then.
app.logout();
}