aboutsummaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-07-07 19:29:43 +0200
committerGitHub <noreply@github.com>2016-07-07 19:29:43 +0200
commit2a1a3957b65e847d51c4c735acf033f7df29cba6 (patch)
treee53ac77b3dfa0d425b9ea8084420988a4d7054b7 /settings
parentf5ed01617045a816977688a6c9e549fdf2dab509 (diff)
parentbeae00a5e5457c41994e54c7f0563245d9ccf5ce (diff)
downloadnextcloud-server-2a1a3957b65e847d51c4c735acf033f7df29cba6.tar.gz
nextcloud-server-2a1a3957b65e847d51c4c735acf033f7df29cba6.zip
Merge pull request #333 from nextcloud/sync-master
Sync master
Diffstat (limited to 'settings')
-rw-r--r--settings/Controller/AuthSettingsController.php37
-rw-r--r--settings/js/authtoken_view.js4
-rw-r--r--settings/js/users/users.js20
-rw-r--r--settings/templates/admin.php8
-rw-r--r--settings/templates/certificates.php2
-rw-r--r--settings/templates/personal.php8
-rw-r--r--settings/templates/users/part.grouplist.php4
-rw-r--r--settings/templates/users/part.userlist.php6
8 files changed, 64 insertions, 25 deletions
diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php
index db2db6e5bfc..e7fc2d916bc 100644
--- a/settings/Controller/AuthSettingsController.php
+++ b/settings/Controller/AuthSettingsController.php
@@ -81,7 +81,28 @@ class AuthSettingsController extends Controller {
if (is_null($user)) {
return [];
}
- return $this->tokenProvider->getTokenByUser($user);
+ $tokens = $this->tokenProvider->getTokenByUser($user);
+
+ try {
+ $sessionId = $this->session->getId();
+ } catch (SessionNotAvailableException $ex) {
+ return $this->getServiceNotAvailableResponse();
+ }
+ try {
+ $sessionToken = $this->tokenProvider->getToken($sessionId);
+ } catch (InvalidTokenException $ex) {
+ return $this->getServiceNotAvailableResponse();
+ }
+
+ return array_map(function(IToken $token) use ($sessionToken) {
+ $data = $token->jsonSerialize();
+ if ($sessionToken->getId() === $token->getId()) {
+ $data['canDelete'] = false;
+ } else {
+ $data['canDelete'] = true;
+ }
+ return $data;
+ }, $tokens);
}
/**
@@ -94,9 +115,7 @@ class AuthSettingsController extends Controller {
try {
$sessionId = $this->session->getId();
} catch (SessionNotAvailableException $ex) {
- $resp = new JSONResponse();
- $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE);
- return $resp;
+ return $this->getServiceNotAvailableResponse();
}
try {
@@ -108,9 +127,7 @@ class AuthSettingsController extends Controller {
$password = null;
}
} catch (InvalidTokenException $ex) {
- $resp = new JSONResponse();
- $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE);
- return $resp;
+ return $this->getServiceNotAvailableResponse();
}
$token = $this->generateRandomDeviceToken();
@@ -123,6 +140,12 @@ class AuthSettingsController extends Controller {
];
}
+ private function getServiceNotAvailableResponse() {
+ $resp = new JSONResponse();
+ $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE);
+ return $resp;
+ }
+
/**
* Return a 20 digit device password
*
diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js
index 01fc1b2ea34..472b841c230 100644
--- a/settings/js/authtoken_view.js
+++ b/settings/js/authtoken_view.js
@@ -29,7 +29,11 @@
'<tr data-id="{{id}}">'
+ '<td class="has-tooltip" title="{{name}}"><span class="token-name">{{name}}</span></td>'
+ '<td><span class="last-activity has-tooltip" title="{{lastActivityTime}}">{{lastActivity}}</span></td>'
+ + '{{#if canDelete}}'
+ '<td><a class="icon-delete has-tooltip" title="' + t('core', 'Disconnect') + '"></a></td>'
+ + '{{else}}'
+ + '<td></td>'
+ + '{{/if}}'
+ '<tr>';
var SubView = OC.Backbone.View.extend({
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index e0fccbd9539..e0fdea64773 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -117,7 +117,7 @@ var UserList = {
* remove action
*/
if ($tr.find('td.remove img').length === 0 && OC.currentUser !== user.name) {
- var deleteImage = $('<img class="svg action">').attr({
+ var deleteImage = $('<img class="action">').attr({
src: OC.imagePath('core', 'actions/delete')
});
var deleteLink = $('<a class="action delete">')
@@ -138,10 +138,13 @@ var UserList = {
.find('option').attr('selected', null)
.first().attr('selected', 'selected');
} else {
- if ($quotaSelect.find('option').filterAttr('value', user.quota).length > 0) {
- $quotaSelect.find('option').filterAttr('value', user.quota).attr('selected', 'selected');
+ var $options = $quotaSelect.find('option');
+ var $foundOption = $options.filterAttr('value', user.quota);
+ if ($foundOption.length > 0) {
+ $foundOption.attr('selected', 'selected');
} else {
- $quotaSelect.append('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>');
+ // append before "Other" entry
+ $options.last().before('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>');
}
}
@@ -576,6 +579,15 @@ var UserList = {
var $select = $(ev.target);
var uid = UserList.getUID($select);
var quota = $select.val();
+ if (quota === 'other') {
+ return;
+ }
+ if (isNaN(parseInt(quota, 10)) || parseInt(quota, 10) < 0) {
+ // the select component has added the bogus value, delete it again
+ $select.find('option[selected]').remove();
+ OC.Notification.showTemporary(t('core', 'Invalid quota value "{val}"', {val: quota}));
+ return;
+ }
UserList._updateQuota(uid, quota, function(returnedQuota){
if (quota !== returnedQuota) {
$select.find(':selected').text(returnedQuota);
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index c0a7424cf67..f41c0d3c101 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -202,7 +202,7 @@ if ($_['cronErrors']) {
<div class="section" id="shareAPI">
<h2><?php p($l->t('Sharing'));?></h2>
- <a target="_blank" el="noreferrer" class="icon-info svg"
+ <a target="_blank" el="noreferrer" class="icon-info"
title="<?php p($l->t('Open documentation'));?>"
href="<?php p(link_to_docs('admin-sharing')); ?>"></a>
<p id="enable">
@@ -314,7 +314,7 @@ if ($_['cronErrors']) {
endif; ?>
</p>
<?php endif; ?>
- <a target="_blank" rel="noreferrer" class="icon-info svg"
+ <a target="_blank" rel="noreferrer" class="icon-info"
title="<?php p($l->t('Open documentation'));?>"
href="<?php p(link_to_docs('admin-background-jobs')); ?>"></a>
@@ -346,7 +346,7 @@ if ($_['cronErrors']) {
<div class="section" id='encryptionAPI'>
<h2><?php p($l->t('Server-side encryption')); ?></h2>
- <a target="_blank" rel="noreferrer" class="icon-info svg"
+ <a target="_blank" rel="noreferrer" class="icon-info"
title="<?php p($l->t('Open documentation'));?>"
href="<?php p(link_to_docs('admin-encryption')); ?>"></a>
@@ -412,7 +412,7 @@ if ($_['cronErrors']) {
<div class="section" id="mail_general_settings">
<form id="mail_general_settings_form" class="mail_settings">
<h2><?php p($l->t('Email server'));?></h2>
- <a target="_blank" rel="noreferrer" class="icon-info svg"
+ <a target="_blank" rel="noreferrer" class="icon-info"
title="<?php p($l->t('Open documentation'));?>"
href="<?php p(link_to_docs('admin-email')); ?>"></a>
diff --git a/settings/templates/certificates.php b/settings/templates/certificates.php
index c1ccdcaef95..16f8dda31ad 100644
--- a/settings/templates/certificates.php
+++ b/settings/templates/certificates.php
@@ -26,7 +26,7 @@
<?php else: ?>style="visibility:hidden;"
<?php endif; ?>><img alt="<?php p($l->t('Delete')); ?>"
title="<?php p($l->t('Delete')); ?>"
- class="svg action"
+ class="action"
src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>"/>
</td>
</tr>
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index bcc803938ba..2f656d39fbb 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -39,9 +39,9 @@
<div class="avatardiv"></div>
<div class="warning hidden"></div>
<?php if ($_['avatarChangeSupported']): ?>
- <label for="uploadavatar" class="inlineblock button icon-upload svg" id="uploadavatarbutton" title="<?php p($l->t('Upload new')); ?>"></label>
- <div class="inlineblock button icon-folder svg" id="selectavatar" title="<?php p($l->t('Select from Files')); ?>"></div>
- <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div>
+ <label for="uploadavatar" class="inlineblock button icon-upload" id="uploadavatarbutton" title="<?php p($l->t('Upload new')); ?>"></label>
+ <div class="inlineblock button icon-folder" id="selectavatar" title="<?php p($l->t('Select from Files')); ?>"></div>
+ <div class="hidden button icon-delete" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div>
<input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield">
<p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p>
<?php else: ?>
@@ -129,7 +129,7 @@ if($_['passwordChangeSupported']) {
placeholder="<?php echo $l->t('New password');?>"
data-typetoggle="#personal-show"
autocomplete="off" autocapitalize="off" autocorrect="off" />
- <input type="checkbox" id="personal-show" name="show" /><label for="personal-show" class="svg"></label>
+ <input type="checkbox" id="personal-show" name="show" /><label for="personal-show"></label>
<input id="passwordbutton" type="submit" value="<?php echo $l->t('Change password');?>" />
<br/>
</form>
diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php
index cd6ac4a1e89..64c602c364c 100644
--- a/settings/templates/users/part.grouplist.php
+++ b/settings/templates/users/part.grouplist.php
@@ -8,7 +8,7 @@
<li id="newgroup-form" style="display: none">
<form>
<input type="text" id="newgroupname" placeholder="<?php p($l->t('Group')); ?>..." />
- <input type="submit" class="button icon-add svg" value="" />
+ <input type="submit" class="button icon-add" value="" />
</form>
</li>
<!-- Everyone -->
@@ -45,7 +45,7 @@
<span class="usercount"><?php if($group['usercount'] > 0) { p($group['usercount']); } ?></span>
<?php if($_['isAdmin']): ?>
<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>">
- <img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" class="svg" />
+ <img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" />
</a>
<?php endif; ?>
</span>
diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php
index 697d0f3f142..c7b2ad58c15 100644
--- a/settings/templates/users/part.userlist.php
+++ b/settings/templates/users/part.userlist.php
@@ -26,15 +26,15 @@
<td class="avatar"><div class="avatardiv"></div></td>
<?php endif; ?>
<th class="name" scope="row"></th>
- <td class="displayName"><span></span> <img class="svg action"
+ <td class="displayName"><span></span> <img class="action"
src="<?php p(image_path('core', 'actions/rename.svg'))?>"
alt="<?php p($l->t("change full name"))?>" title="<?php p($l->t("change full name"))?>"/>
</td>
- <td class="password"><span>●●●●●●●</span> <img class="svg action"
+ <td class="password"><span>●●●●●●●</span> <img class="action"
src="<?php print_unescaped(image_path('core', 'actions/rename.svg'))?>"
alt="<?php p($l->t("set new password"))?>" title="<?php p($l->t("set new password"))?>"/>
</td>
- <td class="mailAddress"><span></span><div class="loading-small hidden"></div> <img class="svg action"
+ <td class="mailAddress"><span></span><div class="loading-small hidden"></div> <img class="action"
src="<?php p(image_path('core', 'actions/rename.svg'))?>"
alt="<?php p($l->t('change email address'))?>" title="<?php p($l->t('change email address'))?>"/>
</td>