adapt code to soko-web 0.4
This commit is contained in:
4 files changed
+35
-79
No files matched your search
@@ -58,7 +58,7 @@ class LoginController
|
||||
return new Redirect($this->redirectUrl, IRedirect::TEMPORARY);
|
||||
}
|
||||
|
||||
return new HtmlContent('login/login', ['redirectUrl' => '/' . $this->redirectUrl]);
|
||||
return new HtmlContent('login/login', ['redirectUrl' => $this->redirectUrl]);
|
||||
}
|
||||
|
||||
public function getGoogleLoginRedirect(): IRedirect
|
||||
@@ -72,7 +72,7 @@ class LoginController
|
||||
$oAuth = new GoogleOAuth(new Request());
|
||||
$url = $oAuth->getDialogUrl(
|
||||
$state,
|
||||
$this->request->getBase() . '/' . \Container::$routeCollection->getRoute('login-google-action')->generateLink(),
|
||||
$this->request->getBase() . \Container::$routeCollection->getRoute('login-google-action')->generateLink(),
|
||||
$nonce
|
||||
);
|
||||
|
||||
@@ -117,7 +117,7 @@ class LoginController
|
||||
|
||||
$user = $this->userRepository->getByEmail($userData['email']);
|
||||
|
||||
return new HtmlContent('login/google_signup', ['found' => $user !== null, 'email' => $userData['email'], 'redirectUrl' => '/' . $this->redirectUrl]);
|
||||
return new HtmlContent('login/google_signup', ['found' => $user !== null, 'email' => $userData['email'], 'redirectUrl' => $this->redirectUrl]);
|
||||
}
|
||||
|
||||
public function getRequestPasswordResetForm()
|
||||
@@ -151,7 +151,7 @@ class LoginController
|
||||
|
||||
$user = $this->userRepository->getById($resetter->getUserId());
|
||||
|
||||
return new HtmlContent('login/reset_password', ['success' => true, 'token' => $token, 'email' => $user->getEmail(), 'redirectUrl' => '/' . $this->redirectUrl]);
|
||||
return new HtmlContent('login/reset_password', ['success' => true, 'token' => $token, 'email' => $user->getEmail(), 'redirectUrl' => $this->redirectUrl]);
|
||||
}
|
||||
|
||||
public function login(): IContent
|
||||
@@ -182,7 +182,7 @@ class LoginController
|
||||
|
||||
return new JsonContent([
|
||||
'redirect' => [
|
||||
'target' => '/' . \Container::$routeCollection->getRoute('signup')->generateLink()
|
||||
'target' => \Container::$routeCollection->getRoute('signup')->generateLink()
|
||||
]
|
||||
]);
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class LoginController
|
||||
$oAuth = new GoogleOAuth(new Request());
|
||||
$tokenData = $oAuth->getToken(
|
||||
$this->request->query('code'),
|
||||
$this->request->getBase() . '/' . \Container::$routeCollection->getRoute('login-google-action')->generateLink()
|
||||
$this->request->getBase() . \Container::$routeCollection->getRoute('login-google-action')->generateLink()
|
||||
);
|
||||
|
||||
if (!isset($tokenData['id_token'])) {
|
||||
@@ -270,7 +270,7 @@ class LoginController
|
||||
{
|
||||
if ($this->request->user() !== null) {
|
||||
$this->deleteRedirectUrl();
|
||||
return new JsonContent(['redirect' => ['target' => '/' . $this->redirectUrl]]);
|
||||
return new JsonContent(['redirect' => ['target' => $this->redirectUrl]]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmail($this->request->post('email'));
|
||||
@@ -290,7 +290,7 @@ class LoginController
|
||||
$this->request->setUser($user);
|
||||
|
||||
$this->deleteRedirectUrl();
|
||||
$data = ['redirect' => ['target' => '/' . $this->redirectUrl]];
|
||||
$data = ['redirect' => ['target' => $this->redirectUrl]];
|
||||
} else {
|
||||
$data = [
|
||||
'error' => [
|
||||
@@ -485,7 +485,7 @@ class LoginController
|
||||
$this->deleteRedirectUrl();
|
||||
return new JsonContent([
|
||||
'redirect' => [
|
||||
'target' => '/' . $this->redirectUrl
|
||||
'target' => $this->redirectUrl
|
||||
]
|
||||
]);
|
||||
}
|
||||
@@ -563,7 +563,7 @@ class LoginController
|
||||
$this->deleteRedirectUrl();
|
||||
return new JsonContent([
|
||||
'redirect' => [
|
||||
'target' => '/' . $this->redirectUrl
|
||||
'target' => $this->redirectUrl
|
||||
]
|
||||
]);
|
||||
}
|
||||
@@ -574,7 +574,7 @@ class LoginController
|
||||
if ($resetter === null || $resetter->getExpiresDate() < new DateTime()) {
|
||||
return new JsonContent([
|
||||
'redirect' => [
|
||||
'target' => '/' . \Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token])
|
||||
'target' => \Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token])
|
||||
]
|
||||
]);
|
||||
}
|
||||
@@ -615,9 +615,9 @@ class LoginController
|
||||
$mail->setSubject('Welcome to ' . $_ENV['APP_NAME'] . ' - Activate your account');
|
||||
$mail->setBodyFromTemplate('signup', [
|
||||
'EMAIL' => $email,
|
||||
'ACTIVATE_LINK' => $this->request->getBase() . '/' .
|
||||
'ACTIVATE_LINK' => $this->request->getBase() .
|
||||
\Container::$routeCollection->getRoute('signup.activate')->generateLink(['token' => $token]),
|
||||
'CANCEL_LINK' => $this->request->getBase() . '/' .
|
||||
'CANCEL_LINK' => $this->request->getBase() .
|
||||
\Container::$routeCollection->getRoute('signup.cancel')->generateLink(['token' => $token]),
|
||||
'ACTIVATABLE_UNTIL' => (clone $created)->add(new DateInterval('P1D'))->format('Y-m-d H:i T')
|
||||
]);
|
||||
@@ -659,7 +659,7 @@ class LoginController
|
||||
$mail->setSubject($_ENV['APP_NAME'] . ' - Password reset');
|
||||
$mail->setBodyFromTemplate('password-reset', [
|
||||
'EMAIL' => $email,
|
||||
'RESET_LINK' => $this->request->getBase() . '/' .
|
||||
'RESET_LINK' => $this->request->getBase() .
|
||||
\Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token]),
|
||||
'EXPIRES' => $expires->format('Y-m-d H:i T')
|
||||
]);
|
||||
|
||||
@@ -78,7 +78,7 @@ class UserController implements IAuthenticationRequired
|
||||
|
||||
$url = $oAuth->getDialogUrl(
|
||||
$state,
|
||||
$this->request->getBase() . '/' . \Container::$routeCollection->getRoute('account.googleAuthenticate-action')->generateLink(),
|
||||
$this->request->getBase() . \Container::$routeCollection->getRoute('account.googleAuthenticate-action')->generateLink(),
|
||||
$nonce,
|
||||
$user->getEmail()
|
||||
);
|
||||
@@ -100,7 +100,7 @@ class UserController implements IAuthenticationRequired
|
||||
$oAuth = new GoogleOAuth(new Request());
|
||||
$tokenData = $oAuth->getToken(
|
||||
$this->request->query('code'),
|
||||
$this->request->getBase() . '/' . \Container::$routeCollection->getRoute('account.googleAuthenticate-action')->generateLink()
|
||||
$this->request->getBase() . \Container::$routeCollection->getRoute('account.googleAuthenticate-action')->generateLink()
|
||||
);
|
||||
|
||||
if (!isset($tokenData['id_token'])) {
|
||||
|
||||
Reference in new issue
Block a user