mirror of
https://github.com/flarum/core.git
synced 2025-05-09 00:45:25 +02:00
Clean up
This commit is contained in:
parent
e3569d39cc
commit
b83c81c06e
@ -54,8 +54,6 @@ trait AuthenticateUserTrait
|
|||||||
// unique token for these attributes and add it to the response, along
|
// unique token for these attributes and add it to the response, along
|
||||||
// with the suggested account information.
|
// with the suggested account information.
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$accessToken = $this->bus->dispatch(new GenerateAccessToken($user->id));
|
|
||||||
|
|
||||||
$payload = ['authenticated' => true];
|
$payload = ['authenticated' => true];
|
||||||
} else {
|
} else {
|
||||||
$token = AuthToken::generate($identification);
|
$token = AuthToken::generate($identification);
|
||||||
@ -64,16 +62,17 @@ trait AuthenticateUserTrait
|
|||||||
$payload = array_merge($identification, $suggestions, ['token' => $token->id]);
|
$payload = array_merge($identification, $suggestions, ['token' => $token->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = sprintf('<script>
|
$content = sprintf(
|
||||||
window.opener.app.authenticationComplete(%s);
|
'<script>window.opener.app.authenticationComplete(%s); window.close();</script>',
|
||||||
window.close();
|
json_encode($payload)
|
||||||
</script>', json_encode($payload));
|
);
|
||||||
|
|
||||||
$response = new HtmlResponse($content);
|
$response = new HtmlResponse($content);
|
||||||
|
|
||||||
if (isset($accessToken)) {
|
if ($user) {
|
||||||
// Extend the token's expiry to 2 weeks so that we can set a
|
// Extend the token's expiry to 2 weeks so that we can set a
|
||||||
// remember cookie
|
// remember cookie
|
||||||
|
$accessToken = $this->bus->dispatch(new GenerateAccessToken($user->id));
|
||||||
$accessToken::unguard();
|
$accessToken::unguard();
|
||||||
$accessToken->update(['expires_at' => new DateTime('+2 weeks')]);
|
$accessToken->update(['expires_at' => new DateTime('+2 weeks')]);
|
||||||
|
|
||||||
|
2
stubs/extension/.gitignore
vendored
2
stubs/extension/.gitignore
vendored
@ -2,3 +2,5 @@
|
|||||||
composer.phar
|
composer.phar
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
node_modules
|
||||||
|
bower_components
|
3
stubs/extension/js/.gitignore
vendored
3
stubs/extension/js/.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
bower_components
|
|
||||||
node_modules
|
|
||||||
dist
|
|
Loading…
x
Reference in New Issue
Block a user