Prompt on destructive user actions
Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
parent
827a3c545a
commit
0efa78d1e2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
!function(t){function e(e){for(var n,o,i=e[0],a=e[1],s=0,c=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&c.push(r[o][0]),r[o]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(u&&u(e);c.length;)c.shift()()}var n={},r={2:0};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var i=new Promise((function(e,o){n=r[t]=[e,o]}));e.push(n[2]=i);var a,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(t){return o.p+"vue-"+({}[t]||t)+".js?v="+{0:"f1063acdadacc88028ec",4:"ab420c4ca7f30b80526c",5:"eccb7d403199aad9b22e",6:"59bceba87023dcbc6a23"}[t]}(t);var u=new Error;a=function(e){s.onerror=s.onload=null,clearTimeout(c);var n=r[t];if(0!==n){if(n){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;u.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,n[1](u)}r[t]=void 0}};var c=setTimeout((function(){a({type:"timeout",target:s})}),12e4);s.onerror=s.onload=a,document.head.appendChild(s)}return Promise.all(e)},o.m=t,o.c=n,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/js/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonpSettings=window.webpackJsonpSettings||[],a=i.push.bind(i);i.push=e,i=i.slice();for(var s=0;s<i.length;s++)e(i[s]);var u=a;o(o.s=313)}([function(t,e,n){var r=n(2),o=n(34),i=n(50),a=n(224),s=r.Symbol,u=o("wks");t.exports=function(t){return u[t]||(u[t]=a&&s[t]||(a?s:i)("Symbol."+t))}},function(t,e,n){"use strict";var r=n(79),o=n(163),i=Object.prototype.toString;function a(t){return"[object Array]"===i.call(t)}function s(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),a(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:a,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:u,isStream:function(t){return s(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,(function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(7))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";n.r(e),function(t,n){
|
||||
!function(t){function e(e){for(var n,o,i=e[0],a=e[1],s=0,c=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&c.push(r[o][0]),r[o]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(u&&u(e);c.length;)c.shift()()}var n={},r={2:0};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var i=new Promise((function(e,o){n=r[t]=[e,o]}));e.push(n[2]=i);var a,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(t){return o.p+"vue-"+({}[t]||t)+".js?v="+{0:"f1063acdadacc88028ec",4:"ab420c4ca7f30b80526c",5:"eccb7d403199aad9b22e",6:"2b1b186c09a7416be73e"}[t]}(t);var u=new Error;a=function(e){s.onerror=s.onload=null,clearTimeout(c);var n=r[t];if(0!==n){if(n){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;u.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,n[1](u)}r[t]=void 0}};var c=setTimeout((function(){a({type:"timeout",target:s})}),12e4);s.onerror=s.onload=a,document.head.appendChild(s)}return Promise.all(e)},o.m=t,o.c=n,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/js/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonpSettings=window.webpackJsonpSettings||[],a=i.push.bind(i);i.push=e,i=i.slice();for(var s=0;s<i.length;s++)e(i[s]);var u=a;o(o.s=313)}([function(t,e,n){var r=n(2),o=n(34),i=n(50),a=n(224),s=r.Symbol,u=o("wks");t.exports=function(t){return u[t]||(u[t]=a&&s[t]||(a?s:i)("Symbol."+t))}},function(t,e,n){"use strict";var r=n(79),o=n(163),i=Object.prototype.toString;function a(t){return"[object Array]"===i.call(t)}function s(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),a(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:a,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:u,isStream:function(t){return s(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,(function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(7))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";n.r(e),function(t,n){
|
||||
/*!
|
||||
* Vue.js v2.6.10
|
||||
* (c) 2014-2019 Evan You
|
||||
|
@ -110,4 +110,4 @@ o.default.use(Jt.a);var he={API_FAILURE:function(e,n){try{var r=n.error.response
|
|||
*
|
||||
*/
|
||||
o.default.use(i.a,{defaultHtml:!1}),Object(a.sync)(ve,Xt),r.nc=btoa(OC.requestToken),r.p=OC.linkTo("settings","js/"),o.default.prototype.t=t,o.default.prototype.OC=OC,o.default.prototype.OCA=OCA,o.default.prototype.oc_userconfig=oc_userconfig;var me=new o.default({router:Xt,store:ve,render:function(t){return t(c)}}).$mount("#content")}]);
|
||||
//# sourceMappingURL=vue-settings-apps-users-management.js.map?v=2fcefb38c8eb1b52e37a
|
||||
//# sourceMappingURL=vue-settings-apps-users-management.js.map?v=f4c9affd98b0b56db100
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,9 @@
|
|||
<!--
|
||||
- @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||||
- @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>
|
||||
-
|
||||
- @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||
- @author Gary Kim <gary@garykim.dev>
|
||||
-
|
||||
- @license GNU AGPL version 3 or any later version
|
||||
-
|
||||
|
@ -428,25 +430,55 @@ export default {
|
|||
},
|
||||
|
||||
wipeUserDevices() {
|
||||
let userid = this.user.id
|
||||
OC.dialogs.confirmDestructive(
|
||||
t('settings', 'In case of lost device or exiting the organization, this can remotely wipe the Nextcloud data from all devices associated with {userid}. Only works if the devices are connected to the internet.', { userid: userid }),
|
||||
t('settings', 'Remote wipe of devices'),
|
||||
{
|
||||
type: OC.dialogs.YES_NO_BUTTONS,
|
||||
confirm: t('settings', 'Wipe {userid}\'s devices', { userid: userid }),
|
||||
confirmClasses: 'error',
|
||||
cancel: t('settings', 'Cancel')
|
||||
},
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.loading.wipe = true
|
||||
this.loading.all = true
|
||||
let userid = this.user.id
|
||||
return this.$store.dispatch('wipeUserDevices', userid)
|
||||
this.$store.dispatch('wipeUserDevices', userid)
|
||||
.then(() => {
|
||||
this.loading.wipe = false
|
||||
this.loading.all = false
|
||||
})
|
||||
}
|
||||
},
|
||||
true
|
||||
)
|
||||
},
|
||||
|
||||
deleteUser() {
|
||||
let userid = this.user.id
|
||||
OC.dialogs.confirmDestructive(
|
||||
t('settings', 'Fully delete {userid}\'s account including all their personal files, app data, etc.', { userid: userid }),
|
||||
t('settings', 'Account deletion'),
|
||||
{
|
||||
type: OC.dialogs.YES_NO_BUTTONS,
|
||||
confirm: t('settings', 'Delete {userid}\'s account', { userid: userid }),
|
||||
confirmClasses: 'error',
|
||||
cancel: t('settings', 'Cancel')
|
||||
},
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.loading.delete = true
|
||||
this.loading.all = true
|
||||
let userid = this.user.id
|
||||
return this.$store.dispatch('deleteUser', userid)
|
||||
.then(() => {
|
||||
this.loading.delete = false
|
||||
this.loading.all = false
|
||||
})
|
||||
}
|
||||
},
|
||||
true
|
||||
)
|
||||
},
|
||||
|
||||
enableDisableUser() {
|
||||
|
|
|
@ -115,6 +115,11 @@ div[contenteditable=true],
|
|||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
&.error {
|
||||
background-color: var(--color-error) !important;
|
||||
border-color: var(--color-error);
|
||||
}
|
||||
}
|
||||
|
||||
div[contenteditable=false] {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,8 +2,10 @@
|
|||
/* eslint-disable */
|
||||
/*
|
||||
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
* @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>
|
||||
*
|
||||
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
* @author Gary Kim <gary@garykim.dev>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
@ -89,6 +91,25 @@ const Dialogs = {
|
|||
modal
|
||||
)
|
||||
},
|
||||
/**
|
||||
* displays confirmation dialog
|
||||
* @param {string} text content of dialog
|
||||
* @param {string} title dialog title
|
||||
* @param {{type: Int, confirm: String, cancel: String, confirmClasses: String}} buttons text content of buttons
|
||||
* @param {function} callback which will be triggered when user presses OK (true or false would be passed to callback respectively)
|
||||
* @param {boolean} [modal] make the dialog modal
|
||||
* @returns {Promise}
|
||||
*/
|
||||
confirmDestructive: function(text, title, buttons, callback, modal) {
|
||||
return this.message(
|
||||
text,
|
||||
title,
|
||||
'none',
|
||||
buttons,
|
||||
callback,
|
||||
modal
|
||||
)
|
||||
},
|
||||
/**
|
||||
* displays confirmation dialog
|
||||
* @param {string} text content of dialog
|
||||
|
@ -534,6 +555,34 @@ const Dialogs = {
|
|||
defaultButton: true
|
||||
}
|
||||
break
|
||||
default:
|
||||
if (typeof(buttons) === 'object') {
|
||||
switch (buttons.type) {
|
||||
case Dialogs.YES_NO_BUTTONS:
|
||||
buttonlist = [{
|
||||
text: buttons.cancel || t('core', 'No'),
|
||||
click: function() {
|
||||
if (callback !== undefined) {
|
||||
callback(false)
|
||||
}
|
||||
$(dialogId).ocdialog('close')
|
||||
}
|
||||
},
|
||||
{
|
||||
text: buttons.confirm || t('core', 'Yes'),
|
||||
click: function() {
|
||||
if (callback !== undefined) {
|
||||
callback(true)
|
||||
}
|
||||
$(dialogId).ocdialog('close')
|
||||
},
|
||||
defaultButton: true,
|
||||
classes: buttons.confirmClasses
|
||||
}]
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
$(dialogId).ocdialog({
|
||||
|
|
|
@ -115,6 +115,9 @@
|
|||
.ui-state-error-text .ui-icon {
|
||||
background-image: url('images/ui-icons_ffd27a_256x240.png');
|
||||
}
|
||||
.ui-icon.ui-icon-none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
|
||||
.oc-dialog-content {
|
||||
width: 100%;
|
||||
max-width: 550px;
|
||||
}
|
||||
|
||||
.oc-dialog.password-confirmation {
|
||||
|
|
Loading…
Reference in New Issue