diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index bd80b17b64..f1adaf8d07 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -32,7 +32,6 @@ namespace OCA\DAV\Connector\Sabre; use Exception; -use OC\AppFramework\Http\Request; use OC\Authentication\Exceptions\PasswordLoginForbiddenException; use OC\Authentication\TwoFactorAuth\Manager; use OC\Security\Bruteforce\Throttler; @@ -176,9 +175,9 @@ class Auth extends AbstractBasic { // Official ownCloud clients require no checks if($this->request->isUserAgent([ - Request::USER_AGENT_OWNCLOUD_DESKTOP, - Request::USER_AGENT_OWNCLOUD_ANDROID, - Request::USER_AGENT_OWNCLOUD_IOS, + IRequest::USER_AGENT_CLIENT_DESKTOP, + IRequest::USER_AGENT_CLIENT_ANDROID, + IRequest::USER_AGENT_CLIENT_IOS, ])) { return false; } diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index 6262407eb9..280a83bb83 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -300,7 +300,7 @@ class AuthTest extends TestCase { ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', - '/^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/', + '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(false); $this->session @@ -350,7 +350,7 @@ class AuthTest extends TestCase { ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', - '/^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/', + '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(false); $this->session @@ -403,7 +403,7 @@ class AuthTest extends TestCase { ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', - '/^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/', + '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(false); $this->session @@ -449,7 +449,7 @@ class AuthTest extends TestCase { ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', - '/^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/', + '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(true); $this->session diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index dae0ee5050..424f290832 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -73,7 +73,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { /** * @deprecated use \OCP\IRequest::USER_AGENT_CLIENT_IOS instead */ - const USER_AGENT_OWNCLOUD_IOS = '/^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/'; + const USER_AGENT_OWNCLOUD_IOS = '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/'; /** * @deprecated use \OCP\IRequest::USER_AGENT_CLIENT_ANDROID instead */ diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index 11242c481f..2f3d2e6711 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -76,7 +76,7 @@ interface IRequest { /** * @since 9.1.0 */ - const USER_AGENT_CLIENT_IOS = '/^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/'; + const USER_AGENT_CLIENT_IOS = '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/'; /** * @param string $name diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index 6eb04b63f2..e5da45632d 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -117,8 +117,9 @@ safari: /^Mozilla\/5\.0 \([^)]*(Windows|OS X)[^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\)(?: Version\/([0-9]+)[0-9.]+)? Safari\/[0-9.A-Z]+$/, // Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent androidChrome: /Android.*(?:; (.*) Build\/).*Chrome\/(\d+)[0-9.]+/, - iphone: / *CPU +iPhone +OS +(\d+)_\d+ +like +Mac +OS +X */, - iosClient: /^Mozilla\/5\.0 \(iOS\) ownCloud\-iOS.*$/, + iphone: / *CPU +iPhone +OS +([0-9]+)_(?:[0-9_])+ +like +Mac +OS +X */, + ipad: /\(iPad\; *CPU +OS +([0-9]+)_(?:[0-9_])+ +like +Mac +OS +X */, + iosClient: /^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/, androidClient:/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/, // DAVdroid/1.2 (2016/07/03; dav4android; okhttp3) Android/6.0.1 davDroid: /DAVdroid\/([0-9.]+)/, @@ -134,7 +135,8 @@ chrome: t('setting', 'Google Chrome'), safari: t('setting', 'Safari'), androidChrome: t('setting', 'Google Chrome for Android'), - iphone: t('setting', 'iPhone'), + iphone: t('setting', 'iPhone iOS'), + ipad: t('setting', 'iPad iOS'), iosClient: t('setting', 'iOS Client'), androidClient: t('setting', 'Android Client'), davDroid: 'DAVdroid',