Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2af041b
Show shared users on first click to dropdown and show searched users …
sananirajabov Mar 17, 2019
f5c3c22
Show shared users on first click to dropdown and show searched users …
sananirajabov Mar 17, 2019
66a61ca
Extend regex to match DAVx5
kesselb Jan 20, 2019
9c9688c
Clipboard -> ClipboardJS
kesselb Jan 20, 2019
f75239f
Make app password description editable
kesselb Jan 20, 2019
3f5cc87
Add canRename & name to tests
kesselb Jan 20, 2019
ebc6ccd
Add interface INamedToken
kesselb Jan 21, 2019
4d38e37
Improve usability
kesselb Feb 2, 2019
43cba67
Don't update token if current session token
kesselb Feb 2, 2019
e41074b
Mock name for integration test
kesselb Feb 4, 2019
53e31c6
Use the new method instead of the deprecated wrapper
nickvergessen Feb 6, 2019
77db0cc
[tx-robot] updated from transifex
nextcloud-bot Feb 9, 2019
7b3f789
Show shared users on first click to dropdown and show searched users …
sananirajabov Mar 17, 2019
dc5f152
Show shared users on first click to dropdown and show searched users …
sananirajabov Mar 17, 2019
e245a21
Reverted whitespaces
sananirajabov Mar 27, 2019
f6eac4d
Rewrote with QueryBuilder and connection injected via constructor
sananirajabov Mar 27, 2019
58e5070
Remove whitespace at line 185
sananirajabov Mar 27, 2019
7b5e439
Remove whitespace at line 306
sananirajabov Mar 27, 2019
51dfc24
Remove whitespaces
sananirajabov Mar 27, 2019
cce883b
Permission 755 to 644
sananirajabov Apr 9, 2019
320687b
Update lib/private/Contacts/ContactsMenu/ContactsStore.php
ChristophWurst Apr 10, 2019
a09df14
Added IDBConnection to constructor
sananirajabov Apr 10, 2019
f88f6db
Getting QueryBuilder from connection
sananirajabov Apr 10, 2019
423b727
imported OCP/IDBConnection
sananirajabov Apr 10, 2019
5c81610
Limit shared users to 25 entries
sananirajabov Apr 11, 2019
58278fc
Revert "imported OCP/IDBConnection"
sananirajabov Apr 17, 2019
fe9869e
conflicted
sananirajabov Apr 17, 2019
4a152a8
Contact Store after merge branches
sananirajabov Apr 17, 2019
481af60
ContactsStore
sananirajabov Apr 17, 2019
571cb82
revert to 644
sananirajabov Apr 17, 2019
9889be0
revert to 644
sananirajabov Apr 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make app password description editable
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: sananirajabov <sananirajabov@gmail.com>
  • Loading branch information
kesselb authored and sananirajabov committed Apr 17, 2019
commit f75239f75a3b74b17228064f6332bc4358faf936
14 changes: 11 additions & 3 deletions settings/Controller/AuthSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
use OC\AppFramework\Http;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Exceptions\PasswordlessTokenException;
use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
use OC\Settings\Activity\Provider;
use OCP\Activity\IManager;
use OC\Authentication\Token\PublicKeyToken;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\ILogger;
Expand Down Expand Up @@ -112,11 +114,11 @@ public function index() {

return array_map(function (IToken $token) use ($sessionToken) {
$data = $token->jsonSerialize();
$data['canDelete'] = true;
$data['canRename'] = $token instanceof DefaultToken || $token instanceof PublicKeyToken;
if ($sessionToken->getId() === $token->getId()) {
$data['canDelete'] = false;
$data['current'] = true;
} else {
$data['canDelete'] = true;
}
return $data;
}, $tokens);
Expand Down Expand Up @@ -212,9 +214,10 @@ public function destroy($id) {
*
* @param int $id
* @param array $scope
* @param string $name
* @return array|JSONResponse
*/
public function update($id, array $scope) {
public function update($id, array $scope, string $name) {
try {
$token = $this->findTokenByIdAndUser($id);
} catch (InvalidTokenException $e) {
Expand All @@ -225,6 +228,11 @@ public function update($id, array $scope) {
'filesystem' => $scope['filesystem']
]);


if ($token instanceof DefaultToken || $token instanceof PublicKeyToken) {
$token->setName($name);
}

$this->tokenProvider->updateToken($token);
$this->publishActivity(Provider::APP_TOKEN_UPDATED, $token->getId(), $token->getName());
return [];
Expand Down
46 changes: 46 additions & 0 deletions settings/js/authtoken_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
data.revokeText = t('settings', 'Revoke');
data.settingsTitle = t('settings', 'Device settings');
data.allowFSAccess = t('settings', 'Allow filesystem access');
data.renameText = t('settings', 'Rename');
return OC.Settings.Templates['authtoken'](data);
},

Expand Down Expand Up @@ -218,6 +219,8 @@
$el.on('click', 'a.icon-delete', _.bind(this._onDeleteToken, this));
$el.on('click', '.icon-more', _.bind(this._onConfigureToken, this));
$el.on('change', 'input.filesystem', _.bind(this._onSetTokenScope, this));
$el.on('click', '.icon-rename', _.bind(this._onRenameToken, this));
$el.on('keyup', 'input.rename-token', _.bind(this._onEnterTokenName, this));

this._form = $('#app-password-form');
this._tokenName = $('#app-password-name');
Expand Down Expand Up @@ -414,6 +417,49 @@
token.save();
},

_onRenameToken: function (event) {
var $target = $(event.target);
var $row = $target.closest('tr');
var id = $row.data('id');

var token = this.collection.get(id);
if (_.isUndefined(token)) {
// Ignore event
return;
}

$row.find('.token-name > span').addClass('hidden');
$row.find('.token-name > input').removeClass('hidden').focus();

this._hideConfigureToken();
},

_onEnterTokenName: function(event) {
var $target = $(event.target);
var $row = $target.closest('tr');
var id = $row.data('id');

var token = this.collection.get(id);
if (_.isUndefined(token)) {
// Ignore event
return;
}

if (event.key === 'Enter') {
token.set('name', $target.context.value);

var _this = this;
$.when(token.save()).always(function () {
_this.render();
});
}

if (event.key === 'Escape') {
$row.find('.token-name > span').removeClass('hidden');
$row.find('.token-name > input').addClass('hidden');
}
},

_toggleFormResult: function (showForm) {
if (showForm) {
this._result.slideUp();
Expand Down
33 changes: 24 additions & 9 deletions settings/js/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,36 @@
templates['authtoken'] = template({"1":function(container,depth0,helpers,partials,data) {
var helper;

return " <input class=\"hidden rename-token\" type=\"text\" value=\""
+ container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"name","hash":{},"data":data}) : helper)))
+ "\" />\n";
},"3":function(container,depth0,helpers,partials,data) {
var helper;

return "<a class=\"icon icon-more has-tooltip\" tabindex=\"0\" title=\""
+ container.escapeExpression(((helper = (helper = helpers.settingsTitle || (depth0 != null ? depth0.settingsTitle : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"settingsTitle","hash":{},"data":data}) : helper)))
+ "\"/>";
},"3":function(container,depth0,helpers,partials,data) {
},"5":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

return " <li><span class=\"menuitem\">\n <input class=\"filesystem checkbox\" type=\"checkbox\" id=\""
+ alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"id","hash":{},"data":data}) : helper)))
+ "_filesystem\" "
+ ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.scope : depth0)) != null ? stack1.filesystem : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.scope : depth0)) != null ? stack1.filesystem : stack1),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " tabindex=\"0\" />\n <label for=\""
+ alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"id","hash":{},"data":data}) : helper)))
+ "_filesystem\">"
+ alias4(((helper = (helper = helpers.allowFSAccess || (depth0 != null ? depth0.allowFSAccess : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"allowFSAccess","hash":{},"data":data}) : helper)))
+ "</label><br/>\n </span></li>\n";
},"4":function(container,depth0,helpers,partials,data) {
return "checked";
},"6":function(container,depth0,helpers,partials,data) {
return "checked";
},"8":function(container,depth0,helpers,partials,data) {
var helper;

return " <li>\n <a class=\"icon icon-rename\" tabindex=\"0\">"
+ container.escapeExpression(((helper = (helper = helpers.renameText || (depth0 != null ? depth0.renameText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"renameText","hash":{},"data":data}) : helper)))
+ "</a>\n </li>\n";
},"10":function(container,depth0,helpers,partials,data) {
var helper;

return " <li>\n <a class=\"icon icon-delete\" tabindex=\"0\">"
Expand All @@ -33,17 +45,20 @@ templates['authtoken'] = template({"1":function(container,depth0,helpers,partial
+ alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"id","hash":{},"data":data}) : helper)))
+ "\">\n <td class=\"client\">\n <div class=\""
+ alias4(((helper = (helper = helpers.icon || (depth0 != null ? depth0.icon : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"icon","hash":{},"data":data}) : helper)))
+ "\" />\n </td>\n <td class=\"token-name\">\n "
+ "\" />\n </td>\n <td class=\"token-name\">\n <span>"
+ alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
+ "\n </td>\n <td>\n <span class=\"last-activity has-tooltip\" title=\""
+ "</span>\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canRename : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </td>\n <td>\n <span class=\"last-activity has-tooltip\" title=\""
+ alias4(((helper = (helper = helpers.lastActivityTime || (depth0 != null ? depth0.lastActivityTime : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"lastActivityTime","hash":{},"data":data}) : helper)))
+ "\">"
+ alias4(((helper = (helper = helpers.lastActivity || (depth0 != null ? depth0.lastActivity : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"lastActivity","hash":{},"data":data}) : helper)))
+ "</span></td>\n <td class=\"more\">\n "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showMore : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showMore : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n <div class=\"popovermenu menu\">\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canScope : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canDelete : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canScope : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canRename : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canDelete : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </div>\n </td>\n</tr>\n";
},"useData":true});
templates['federationscopemenu'] = template({"1":function(container,depth0,helpers,partials,data) {
Expand Down
10 changes: 9 additions & 1 deletion settings/js/templates/authtoken.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<div class="{{icon}}" />
</td>
<td class="token-name">
{{name}}
<span>{{name}}</span>
{{#if canRename}}
<input class="hidden rename-token" type="text" value="{{name}}" />
{{/if}}
</td>
<td>
<span class="last-activity has-tooltip" title="{{lastActivityTime}}">{{lastActivity}}</span></td>
Expand All @@ -16,6 +19,11 @@
<label for="{{id}}_filesystem">{{allowFSAccess}}</label><br/>
</span></li>
{{/if}}
{{#if canRename}}
<li>
<a class="icon icon-rename" tabindex="0">{{renameText}}</a>
</li>
{{/if}}
{{#if canDelete}}
<li>
<a class="icon icon-delete" tabindex="0">{{revokeText}}</a>
Expand Down