mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-26 12:25:20 +01:00
import validation
This commit is contained in:
parent
e7a9699226
commit
517ea65bc9
@ -5,6 +5,11 @@
|
||||
var _service = {};
|
||||
|
||||
_service.import = function (source, file, success, error) {
|
||||
if (!file) {
|
||||
error();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (source) {
|
||||
case 'local':
|
||||
importLocal(file, success, error);
|
||||
|
@ -25,9 +25,15 @@
|
||||
}, importError);
|
||||
}
|
||||
|
||||
function importError() {
|
||||
function importError(errorMessage) {
|
||||
$analytics.eventTrack('Import Data Failed', { label: $scope.model.source });
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
toastr.error('Something went wrong. Try again.', 'Oh No!');
|
||||
if (errorMessage) {
|
||||
toastr.error(errorMessage);
|
||||
}
|
||||
else {
|
||||
toastr.error('Something went wrong. Try again.', 'Oh No!');
|
||||
}
|
||||
}
|
||||
|
||||
$scope.close = function () {
|
||||
|
@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="file">File</label>
|
||||
<input type="file" id="file" name="file" />
|
||||
<input type="file" id="file" name="file" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
Loading…
Reference in New Issue
Block a user