Created
July 2, 2018 09:32
-
-
Save studio-fars-company/67bf64d9ad127802f690b19079a3a1cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Sentinel; | |
use Illuminate\Http\Request; | |
use App\Http\Controllers\Controller; | |
use Activation; | |
use Sentinel; | |
class ActivateController extends Controller | |
{ | |
/** | |
* アクティベーション | |
*/ | |
protected function activate(Request $request) { | |
// ユーザーを取得する | |
$user = Sentinel::findByCredentials(['email' => base64_decode($request->email)]); | |
if (is_null($user)) { | |
return redirect('login')->with(['myerror' => trans('sentinel.invalid_activation_params')]); | |
} | |
// アクティベーション済みだった場合、そのまま戻る | |
if (Activation::completed($user)) { | |
return redirect('login'); | |
} | |
// アクティベーションを実行する | |
if (!Activation::complete($user, $request->code)) { | |
return redirect('login')->with(['myerror' => trans('sentinel.invalid_activation_params')]); | |
} | |
return redirect('login')->with(['info' => trans('sentinel.activation_done')]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment