aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication/Login/CompleteLoginCommand.php
blob: ec6fdf75f40d5880e6de6b948307cd02d0b9360e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OC\Authentication\Login;

use OC\User\Session;

class CompleteLoginCommand extends ALoginCommand {
	/** @var Session */
	private $userSession;

	public function __construct(Session $userSession) {
		$this->userSession = $userSession;
	}

	public function process(LoginData $loginData): LoginResult {
		$this->userSession->completeLogin(
			$loginData->getUser(),
			[
				'loginName' => $loginData->getUsername(),
				'password' => $loginData->getPassword(),
			]
		);

		return $this->processNextOrFinishSuccessfully($loginData);
	}
}