Merge pull request #9966 from nextcloud/resend-welcome-email

Resend activation email for new users as admin
This commit is contained in:
Morris Jobke 2018-06-26 11:41:27 +02:00 committed by GitHub
commit a97cc293b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 82 additions and 21 deletions

View File

@ -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,6 +1524,7 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
display: block;
}
}
&.userActions {
.toggleUserActions {
position: relative;
.icon-more {
@ -1528,11 +1532,22 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
height: 44px;
opacity: .5;
cursor: pointer;
:hover {
&: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;
}
}
}
/* Fill the grid cell */
.multiselect.multiselect-vue {
width: 100%;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -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,

View File

@ -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;
});
}
}
}

View File

@ -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 }));
}
};