Skip to content

Commit

Permalink
Merge pull request #197 from nextcloud/fix/settings-section
Browse files Browse the repository at this point in the history
Show settings in 'security' section
  • Loading branch information
ChristophWurst authored Oct 9, 2017
2 parents 4523694 + f35140b commit f56d442
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:

env:
global:
- CORE_BRANCH=stable12
- CORE_BRANCH=master
- PHP_COVERAGE=FALSE
- SAUCE=FALSE
matrix:
Expand Down
4 changes: 1 addition & 3 deletions appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @author Christoph Wurst <[email protected]>
*
* ownCloud - Two-factor TOPT
* Two-factor TOTP
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
Expand All @@ -23,5 +23,3 @@
include_once __DIR__ . '/../vendor/autoload.php';

$app = new Application();

OC_App::registerPersonal('twofactor_totp', 'settings/personal');
5 changes: 4 additions & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<screenshot>https://raw.githubusercontent.com/nextcloud/twofactor_totp/dd1e48deec73a250886f35f3924186f5357f4c5f/screenshots/settings.png</screenshot>
<dependencies>
<php min-version="5.6" max-version="7.1" />
<nextcloud min-version="12" max-version="12" />
<nextcloud min-version="13" max-version="13" />
</dependencies>
<two-factor-providers>
<provider>OCA\TwoFactorTOTP\Provider\TotpProvider</provider>
Expand All @@ -31,4 +31,7 @@
<provider>OCA\TwoFactorTOTP\Activity\Provider</provider>
</providers>
</activity>
<settings>
<personal>OCA\TwoFactorTOTP\Settings\Personal</personal>
</settings>
</info>
52 changes: 52 additions & 0 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* @author Christoph Wurst <[email protected]>
*
* Two-factor TOTP
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCA\TwoFactorTOTP\Settings;

use OCP\AppFramework\Http\TemplateResponse;
use OCP\Settings\ISettings;

class Personal implements ISettings {

/**
* @return TemplateResponse
*/
public function getForm() {
return new TemplateResponse('twofactor_totp', 'personal');
}

/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'security';
}

/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
public function getPriority() {
return 40;
}

}
5 changes: 0 additions & 5 deletions settings/personal.php

This file was deleted.

10 changes: 2 additions & 8 deletions tests/Acceptance/TOTPAcceptanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,8 @@ public function testEnableTOTP() {
$this->webDriver->findElement(WebDriverBy::id('password'))->sendKeys('admin');
$this->webDriver->findElement(WebDriverBy::cssSelector('form[name=login] input[type=submit]'))->click();

// Go to personal settings
$this->webDriver->wait(20, 200)->until(WebDriverExpectedCondition::elementToBeClickable(WebDriverBy::id('expandDisplayName')));
$this->webDriver->findElement(WebDriverBy::id('expandDisplayName'))->click();
$this->webDriver->findElement(WebDriverBy::linkText('Personal'))->click();

// Go to TOTP settings
$this->webDriver->wait(20, 200)->until(WebDriverExpectedCondition::elementToBeClickable(WebDriverBy::linkText('TOTP second-factor auth')));
$this->webDriver->findElement(WebDriverBy::linkText('TOTP second-factor auth'))->click();
// Go to personal settings and TOTP settings
$this->webDriver->get('http://localhost:8080/index.php/settings/user/security');

// Enable TOTP
// Wait for state being loaded from the server
Expand Down

0 comments on commit f56d442

Please sign in to comment.