コード例 #1
0
ファイル: Mfa.php プロジェクト: eveseat/web
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // If we are already multifactored, then the
     // session key will exist as true.
     if (session('multifactored')) {
         return $next($request);
     }
     // If no session key is available, check that
     // the user us configured for mfa
     if (Profile::get('require_mfa') == "yes" && !empty(auth()->user()->mfa_token)) {
         return redirect()->route('auth.login.mfa');
     }
     return $next($request);
 }
コード例 #2
0
ファイル: ProfileController.php プロジェクト: freedenizen/web
 /**
  * @param \Seat\Web\Validation\ProfileSettings $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getUpdateUserSettings(ProfileSettings $request)
 {
     // If the multifactor authentication is being disabled,
     // clear out the token we have on record too.
     if ($request->require_mfa == "no" && Profile::get('require_mfa') == "yes") {
         auth()->user()->update(['mfa_token' => null]);
     }
     // Update the settings
     Profile::set('main_character_id', $request->main_character_id);
     Profile::set('main_character_name', $this->getCharacterNameById($request->main_character_id));
     Profile::set('skin', $request->skin);
     Profile::set('language', $request->language);
     Profile::set('sidebar', $request->sidebar);
     Profile::set('thousand_seperator', $request->thousand_seperator);
     Profile::set('decimal_seperator', $request->decimal_seperator);
     Profile::set('email_notifications', $request->email_notifications);
     Profile::set('require_mfa', $request->require_mfa);
     return redirect()->back()->with('success', 'Profile settings updated!');
 }
コード例 #3
0
ファイル: helpers.php プロジェクト: warlof/services
/**
 * Retrive a Setting value
 *
 * @param      $name
 * @param bool $global
 *
 * @return mixed
 */
function setting($name, $global = false)
{
    if ($global) {
        return \Seat\Services\Settings\Seat::get($name);
    }
    return \Seat\Services\Settings\Profile::get($name);
}
コード例 #4
0
ファイル: helpers.php プロジェクト: eveseat/services
 /**
  * Work with settings.
  *
  * Providing a string argument will retreive a setting.
  * Providing an array arguement will set a setting.
  *
  * @param      $name
  * @param bool $global
  *
  * @return mixed
  * @throws \Seat\Services\Exceptions\SettingException
  */
 function setting($name, bool $global = false)
 {
     // If we received an array, it means we want to set.
     if (is_array($name)) {
         // Check that we have at least 2 keys.
         if (count($name) < 2) {
             throw new \Seat\Services\Exceptions\SettingException('Must provide a name and value when setting a setting.');
         }
         // If we have a third element in the array, set it.
         $for_id = $name[2] ?? null;
         if ($global) {
             return \Seat\Services\Settings\Seat::set($name[0], $name[1], $for_id);
         }
         return \Seat\Services\Settings\Profile::set($name[0], $name[1], $for_id);
     }
     // If we just got a string, it means we want to get.
     if ($global) {
         return \Seat\Services\Settings\Seat::get($name);
     }
     return \Seat\Services\Settings\Profile::get($name);
 }