mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-10 17:27:40 +08:00
Fix OTP not working
Fix [Object object] for file fields. Add a copy icon to share link Signed-off-by: brantje <brantje@gmail.com>
This commit is contained in:
parent
e0a6ced85d
commit
39bd0d8b20
9 changed files with 46 additions and 26 deletions
|
@ -60,7 +60,7 @@ class TranslationController extends ApiController {
|
|||
'error.loading.file.perm' => $this->trans->t('Error downloading file, you probably don\'t have enough permissions'),
|
||||
|
||||
// js/app/controllers/edit_credential.js
|
||||
|
||||
'invalid.qr' => $this->trans->t('Invalid QR code'),
|
||||
|
||||
// js/app/controllers/export.js
|
||||
'export.starting' => $this->trans->t('Starting export'),
|
||||
|
|
|
@ -937,4 +937,7 @@
|
|||
padding-right: 0;
|
||||
padding-left: 0; }
|
||||
|
||||
.clearfix {
|
||||
clear: both; }
|
||||
|
||||
/*# sourceMappingURL=app.css.map */
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -274,18 +274,21 @@
|
|||
};
|
||||
|
||||
$scope.parseQR = function (QRCode) {
|
||||
var re = /otpauth:\/\/(totp|hotp)\/(.*)\?(secret|issuer)=(.*)&(issuer|secret)=(.*)/, parsedQR, qrInfo;
|
||||
qrInfo = [];
|
||||
parsedQR = (QRCode.qrData.match(re));
|
||||
if (parsedQR)
|
||||
qrInfo = {
|
||||
type: parsedQR[1],
|
||||
label: decodeURIComponent(parsedQR[2]),
|
||||
qr_uri: QRCode
|
||||
if (!QRCode) {
|
||||
NotificationService.showNotification($translate.instant('invalid.qr'), 5000);
|
||||
return;
|
||||
}
|
||||
/** global: URL */
|
||||
var uri = new URL(QRCode.qrData);
|
||||
var type = (uri.href.indexOf('totp/') !== -1) ? 'totp' : 'hotp';
|
||||
var label = uri.pathname.replace('//'+ type +'/', '');
|
||||
$scope.storedCredential.otp = {
|
||||
type: type,
|
||||
label: decodeURIComponent(label),
|
||||
qr_uri: QRCode,
|
||||
issuer: uri.searchParams.get('issuer'),
|
||||
secret: uri.searchParams.get('secret')
|
||||
};
|
||||
qrInfo[parsedQR[3]] = parsedQR[4];
|
||||
qrInfo[parsedQR[5]] = parsedQR[6];
|
||||
$scope.storedCredential.otp = qrInfo;
|
||||
$scope.$digest();
|
||||
};
|
||||
|
||||
|
|
|
@ -34,15 +34,18 @@
|
|||
return {
|
||||
scope: {
|
||||
value: '=value',
|
||||
secret: '=secret'
|
||||
secret: '=secret',
|
||||
inputField: '=useInput',
|
||||
inputFieldplaceholder: '=inputPlaceholder'
|
||||
},
|
||||
restrict: 'A',
|
||||
replace: 'true',
|
||||
template: "" +
|
||||
'<span class="credential_field">' +
|
||||
'<div class="value" ng-class="{\'ellipsis\': isLink}">' +
|
||||
'<span ng-repeat="n in [] | range:value.length" ng-if="!valueVisible">*</span>' +
|
||||
'<span ng-if="valueVisible" ng-bind-html="value"></span>' +
|
||||
'<span ng-if="secret"><span ng-repeat="n in [] | range:value.length" ng-if="!valueVisible">*</span></span>' +
|
||||
'<span ng-if="valueVisible && !inputField" ng-bind-html="value"></span>' +
|
||||
'<span ng-if="valueVisible && inputField"><input type="text" ng-model="value" select-on-click placeholder="{{ inputFieldplaceholder }}!"</span>' +
|
||||
'</div>' +
|
||||
'<div class="tools">' +
|
||||
'<div class="cell" ng-if="toggle" tooltip="tggltxt" ng-click="toggleVisibility()"><i class="fa" ng-class="{\'fa-eye\': !valueVisible, \'fa-eye-slash\': valueVisible }"></i></div>' +
|
||||
|
|
|
@ -89,7 +89,7 @@ angular.module('views/partials/forms/share_credential/basics.html', []).run(['$t
|
|||
angular.module('views/partials/forms/share_credential/link_sharing.html', []).run(['$templateCache', function($templateCache) {
|
||||
'use strict';
|
||||
$templateCache.put('views/partials/forms/share_credential/link_sharing.html',
|
||||
'<div class="row"><div class="col-xs-12 col-md-6"><label><input type="checkbox" ng-model="share_settings.linkSharing.enabled"> {{ \'enable.link.sharing\' | translate}}.</label><br><input type="text" ng-model="share_link" select-on-click placeholder="{{ \'click.share\' | translate}}!" ng-if="share_settings.linkSharing.enabled"><div ng-show="share_settings.linkSharing.enabled">{{ \'share.until.date\' | translate}} <span datetime-picker ng-model="share_settings.linkSharing.settings.expire_time" class="link" future-only close-on-select="false" timestamp="true">{{ share_settings.linkSharing.settings.expire_time | date:\'dd-MM-yyyy @ HH:mm:ss\' }}</span></div><div ng-show="share_settings.linkSharing.enabled">{{ \'expire.views\' | translate}}<br><input type="number" ng-model="share_settings.linkSharing.settings.expire_views"></div><div ng-if="share_settings.linkSharing.enabled"><table><tr><td><input type="checkbox" ng-click="setPermission(share_settings.linkSharing.settings.acl, default_permissions.permissions.FILES)" ng-checked="hasPermission(share_settings.linkSharing.settings.acl, default_permissions.permissions.FILES)"></td><td>{{ \'show.files\' | translate}}</td></tr></table></div></div></div>');
|
||||
'<div class="row"><div class="col-xs-12 col-md-6"><label><input type="checkbox" ng-model="share_settings.linkSharing.enabled"> {{ \'enable.link.sharing\' | translate}}.</label><br><div class="pull-left col-xs-6 nopadding"><span credential-field value="share_link" secret="false" use-input="true" input-placeholder="\'click.share\' | translate"></span></div><div ng-show="share_settings.linkSharing.enabled" class="clearfix">{{ \'share.until.date\' | translate}} <span datetime-picker ng-model="share_settings.linkSharing.settings.expire_time" class="link" future-only close-on-select="false" timestamp="true">{{ share_settings.linkSharing.settings.expire_time | date:\'dd-MM-yyyy @ HH:mm:ss\' }}</span></div><div ng-show="share_settings.linkSharing.enabled">{{ \'expire.views\' | translate}}<br><input type="number" ng-model="share_settings.linkSharing.settings.expire_views"></div><div ng-if="share_settings.linkSharing.enabled"><table><tr><td><input type="checkbox" ng-click="setPermission(share_settings.linkSharing.settings.acl, default_permissions.permissions.FILES)" ng-checked="hasPermission(share_settings.linkSharing.settings.acl, default_permissions.permissions.FILES)"></td><td>{{ \'show.files\' | translate}}</td></tr></table></div></div></div>');
|
||||
}]);
|
||||
|
||||
angular.module('views/partials/password-meter.html', []).run(['$templateCache', function($templateCache) {
|
||||
|
|
|
@ -100,3 +100,6 @@
|
|||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
.clearfix{
|
||||
clear: both;
|
||||
}
|
|
@ -144,7 +144,8 @@ style('passman', 'public-page');
|
|||
</td>
|
||||
<td>
|
||||
<div ng-repeat="file in shared_credential.files"
|
||||
class="link" ng-click="downloadFile(shared_credential, file)">
|
||||
class="link"
|
||||
ng-click="downloadFile(shared_credential, file)">
|
||||
{{file.filename}} ({{file.size | bytes}})
|
||||
</div>
|
||||
</td>
|
||||
|
@ -154,8 +155,8 @@ style('passman', 'public-page');
|
|||
{{field.label}}
|
||||
</td>
|
||||
<td>
|
||||
<span credential-field value="field.value"
|
||||
secret="field.secret"></span>
|
||||
<span credential-field value="field.value" secret="field.secret" ng-if="field.field_type !== 'file' || !field.field_type"></span>
|
||||
<span ng-if="field.field_type === 'file'" class="link" ng-click="downloadFile(shared_credential, field.value)">{{field.value.filename}} ({{field.value.size | bytes}})</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr ng-show="shared_credential.expire_time > 0">
|
||||
|
@ -194,7 +195,12 @@ style('passman', 'public-page');
|
|||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<a href="https://github.com/nextcloud/passman" target="_blank" class="link">Github</a> | <a href="https://github.com/nextcloud/passman/wiki" target="_blank" class="link">Wiki</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6YS8F97PETVU2" target="_blank" class="link">Donate</a>
|
||||
<a href="https://github.com/nextcloud/passman" target="_blank"
|
||||
class="link">Github</a> | <a
|
||||
href="https://github.com/nextcloud/passman/wiki"
|
||||
target="_blank" class="link">Wiki</a> | <a
|
||||
href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6YS8F97PETVU2"
|
||||
target="_blank" class="link">Donate</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
<div class="col-xs-12 col-md-6">
|
||||
<label><input type="checkbox" ng-model="share_settings.linkSharing.enabled">
|
||||
{{ 'enable.link.sharing' | translate}}.</label><br/>
|
||||
<input type="text" ng-model="share_link" select-on-click placeholder="{{ 'click.share' | translate}}!"
|
||||
ng-if="share_settings.linkSharing.enabled">
|
||||
<div ng-show="share_settings.linkSharing.enabled">
|
||||
<div class="pull-left col-xs-6 nopadding">
|
||||
<span credential-field value="share_link" secret="false" use-input="true" input-placeholder="'click.share' | translate" ></span>
|
||||
</div>
|
||||
|
||||
<div ng-show="share_settings.linkSharing.enabled" class="clearfix">
|
||||
{{ 'share.until.date' | translate}}
|
||||
<span datetime-picker
|
||||
ng-model="share_settings.linkSharing.settings.expire_time"
|
||||
|
|
Loading…
Reference in a new issue