Resend activation email for new users as admin

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
pull/9966/head
John Molakvoæ (skjnldsv) 6 years ago
parent dfbc21d806
commit d3d357fb94
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF

@ -1387,6 +1387,8 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
&.disabled {
opacity: .5;
}
/* grid col width */
.name,
.displayName,
.password {
@ -1407,14 +1409,15 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
width: 250px;
}
.userBackend,
.lastLogin,
.userActions {
.lastLogin {
width: 100px;
}
.obfuscated {
width: 400px;
opacity: .7;
}
/* various */
&#grid-header,
&#new-user {
position: sticky;
@ -1521,15 +1524,27 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
display: block;
}
}
.toggleUserActions {
position: relative;
.icon-more {
width: 44px;
height: 44px;
opacity: .5;
cursor: pointer;
:hover {
opacity: .7;
&.userActions {
.toggleUserActions {
position: relative;
.icon-more {
width: 44px;
height: 44px;
opacity: .5;
cursor: pointer;
&:hover {
opacity: .7;
}
}
}
.feedback {
display: flex;
align-items: center;
white-space: nowrap;
transition: opacity 200ms ease-in-out;
.icon-checkmark {
opacity: .5;
margin-right: 5px;
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{
"name": "settings",
"version": "1.1.1",
"version": "1.2.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -1,7 +1,7 @@
{
"name": "settings",
"description": "Nextcloud settings",
"version": "1.1.1",
"version": "1.2.0",
"author": "John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>",
"license": "AGPL3",
"private": true,

@ -114,6 +114,10 @@
<popover-menu :menu="userActions" />
</div>
</div>
<div class="feedback" :style="{opacity: feedbackMessage !== '' ? 1 : 0}">
<div class="icon-checkmark"></div>
{{feedbackMessage}}
</div>
</div>
</div>
</template>
@ -146,6 +150,7 @@ export default {
return {
rand: parseInt(Math.random() * 1000),
openedMenu: false,
feedbackMessage: '',
loading: {
all: false,
displayName: false,
@ -163,7 +168,7 @@ export default {
computed: {
/* USER POPOVERMENU ACTIONS */
userActions() {
return [{
let actions = [{
icon: 'icon-delete',
text: t('settings','Delete user'),
action: this.deleteUser
@ -171,7 +176,15 @@ export default {
icon: this.user.enabled ? 'icon-close' : 'icon-add',
text: this.user.enabled ? t('settings','Disable user') : t('settings','Enable user'),
action: this.enableDisableUser
}]
}];
if (this.user.email !== null && this.user.email !== '') {
actions.push({
icon: 'icon-mail',
text: t('settings','Resend welcome email'),
action: this.sendWelcomeMail
})
}
return actions;
},
/* GROUPS MANAGEMENT */
@ -289,7 +302,7 @@ export default {
this.loading.delete = true;
this.loading.all = true;
let userid = this.user.id;
return this.$store.dispatch('deleteUser', {userid})
return this.$store.dispatch('deleteUser', userid)
.then(() => {
this.loading.delete = false
this.loading.all = false
@ -506,6 +519,24 @@ export default {
value: lang.code
}).then(() => this.loading.languages = false);
return lang;
},
/**
* Dispatch new welcome mail request
*/
sendWelcomeMail() {
this.loading.all = true;
this.$store.dispatch('sendWelcomeMail', this.user.id)
.then(success => {
if (success) {
// Show feedback to indicate the success
this.feedbackMessage = t('setting', 'Welcome mail sent!');
setTimeout(() => {
this.feedbackMessage = '';
}, 2000);
}
this.loading.all = false;
});
}
}
}

@ -41,7 +41,7 @@ const defaults = {
usercount: 0,
disabled: 0
}
}
};
const state = {
users: [],
@ -395,7 +395,7 @@ const actions = {
* @param {string} userid User id
* @returns {Promise}
*/
deleteUser(context, { userid }) {
deleteUser(context, userid) {
return api.requireAdmin().then((response) => {
return api.delete(OC.linkToOCS(`cloud/users/${userid}`, 2))
.then((response) => context.commit('deleteUser', userid))
@ -484,6 +484,21 @@ const actions = {
}
}
return Promise.reject(new Error('Invalid request data'));
},
/**
* Send welcome mail
*
* @param {Object} context
* @param {string} userid User id
* @returns {Promise}
*/
sendWelcomeMail(context, userid) {
return api.requireAdmin().then((response) => {
return api.post(OC.linkToOCS(`cloud/users/${userid}/welcome`, 2))
.then(response => true)
.catch((error) => {throw error;});
}).catch((error) => context.commit('API_FAILURE', { userid, error }));
}
};

Loading…
Cancel
Save