Skip to content

Commit

Permalink
Merge branch 'main' of github.com:wintercms/wn-user-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed May 11, 2021
2 parents c314947 + c43eae6 commit a60045b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions classes/AuthManager.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php namespace Winter\User\Classes;

use Winter\Storm\Auth\Manager as RainAuthManager;
use Winter\Storm\Auth\Manager as StormAuthManager;
use Winter\User\Models\Settings as UserSettings;
use Winter\User\Models\UserGroup as UserGroupModel;

class AuthManager extends RainAuthManager
class AuthManager extends StormAuthManager
{
protected static $instance;

Expand Down
27 changes: 23 additions & 4 deletions classes/UserRedirector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class UserRedirector extends Redirector
*/
public function guest($path, $status = 302, $headers = [], $secure = null)
{
$sessionKey = App::runningInBackend() ? 'url.intended' : 'url.frontend.intended';
$this->session->put($sessionKey, $this->generator->full());
$this->session->put($this->getItendedSessionKey(), $this->generator->full());

return $this->to($path, $status, $headers, $secure);
}
Expand All @@ -33,9 +32,29 @@ public function guest($path, $status = 302, $headers = [], $secure = null)
*/
public function intended($default = '/', $status = 302, $headers = [], $secure = null)
{
$sessionKey = App::runningInBackend() ? 'url.intended' : 'url.frontend.intended';
$path = $this->session->pull($sessionKey, $default);
$path = $this->session->pull($this->getItendedSessionKey(), $default);

return $this->to($path, $status, $headers, $secure);
}

/**
* Set the intended url.
*
* @param string $url
* @return void
*/
public function setIntendedUrl($url)
{
$this->session->put($this->getItendedSessionKey(), $url);
}

/**
* Get the session key for the intended redirect
*
* @return string
*/
protected function getItendedSessionKey()
{
return App::runningInBackend() ? 'url.intended' : 'url.frontend.intended';
}
}

0 comments on commit a60045b

Please sign in to comment.