mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
fix: Add translation for temporary app password names
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
f4acd8a7ab
commit
8b4491ae1c
4 changed files with 11 additions and 11 deletions
|
|
@ -27,6 +27,7 @@ use OCP\Authentication\Exceptions\InvalidTokenException;
|
|||
use OCP\Authentication\Exceptions\WipeTokenException;
|
||||
use OCP\Authentication\Token\IToken;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -49,6 +50,7 @@ class AuthSettingsController extends Controller {
|
|||
private RemoteWipe $remoteWipe,
|
||||
private LoggerInterface $logger,
|
||||
private IConfig $serverConfig,
|
||||
private IL10N $l,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
|
@ -92,11 +94,13 @@ class AuthSettingsController extends Controller {
|
|||
|
||||
if ($qrcodeLogin) {
|
||||
if ($this->appConfig->getAppValueBool(ConfigLexicon::LOGIN_QRCODE_ONETIME)) {
|
||||
$name = 'One time login';
|
||||
// TRANSLATORS Fallback name for the temporary app password when using the QR code login
|
||||
$name = $this->l->t('One time login');
|
||||
$type = IToken::ONETIME_TOKEN;
|
||||
$scope = [];
|
||||
} else {
|
||||
$name = 'QR Code login';
|
||||
// TRANSLATORS Fallback name for the app password when using the QR code login
|
||||
$name = $this->l->t('QR Code login');
|
||||
$type = IToken::PERMANENT_TOKEN;
|
||||
$scope = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use OCP\Activity\IManager;
|
|||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Services\IAppConfig;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -40,6 +41,7 @@ class AuthSettingsControllerTest extends TestCase {
|
|||
private IAppConfig&MockObject $appConfig;
|
||||
private RemoteWipe&MockObject $remoteWipe;
|
||||
private IConfig&MockObject $serverConfig;
|
||||
private IL10N&MockObject $l;
|
||||
private string $uid = 'jane';
|
||||
private AuthSettingsController $controller;
|
||||
|
||||
|
|
@ -57,6 +59,7 @@ class AuthSettingsControllerTest extends TestCase {
|
|||
$this->serverConfig = $this->createMock(IConfig::class);
|
||||
/** @var LoggerInterface&MockObject $logger */
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$this->l = $this->createMock(IL10N::class);
|
||||
|
||||
$this->controller = new AuthSettingsController(
|
||||
'core',
|
||||
|
|
@ -71,6 +74,7 @@ class AuthSettingsControllerTest extends TestCase {
|
|||
$this->remoteWipe,
|
||||
$logger,
|
||||
$this->serverConfig,
|
||||
$this->l,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4237,12 +4237,6 @@
|
|||
<ImplementedReturnTypeMismatch>
|
||||
<code><![CDATA[boolean|null]]></code>
|
||||
</ImplementedReturnTypeMismatch>
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[$this->tokenProvider->getToken($password)]]></code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MoreSpecificReturnType>
|
||||
<code><![CDATA[?IToken]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
<NoInterfaceProperties>
|
||||
<code><![CDATA[$request->server]]></code>
|
||||
<code><![CDATA[$request->server]]></code>
|
||||
|
|
|
|||
|
|
@ -493,11 +493,9 @@ class Session implements IUserSession, Emitter {
|
|||
/**
|
||||
* Check if the given 'password' is actually a device token
|
||||
*
|
||||
* @param string $password
|
||||
* @return ?IToken
|
||||
* @throws ExpiredTokenException
|
||||
*/
|
||||
private function getTokenFromPassword(string $password): ?IToken {
|
||||
private function getTokenFromPassword(string $password): ?\OCP\Authentication\Token\IToken {
|
||||
try {
|
||||
return $this->tokenProvider->getToken($password);
|
||||
} catch (ExpiredTokenException $e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue