mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
ff4fd2fc9a
refs b0ff1e7cac
- Adds "impersonate" button which would be triggering a popup window with "login url" that allows to log in as a member
34 lines
922 B
JavaScript
34 lines
922 B
JavaScript
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
|
|
import {alias} from '@ember/object/computed';
|
|
import {inject as service} from '@ember/service';
|
|
import {task, timeout} from 'ember-concurrency';
|
|
|
|
export default ModalComponent.extend({
|
|
config: service(),
|
|
store: service(),
|
|
|
|
classNames: 'modal-impersonate-member',
|
|
|
|
signinUrl: null,
|
|
member: alias('model'),
|
|
|
|
didInsertElement() {
|
|
this._super(...arguments);
|
|
|
|
this._signinUrlUpdateTask.perform();
|
|
},
|
|
|
|
copySigninUrl: task(function* () {
|
|
copyTextToClipboard(this.get('signinUrl'));
|
|
yield timeout(1000);
|
|
return true;
|
|
}),
|
|
|
|
_signinUrlUpdateTask: task(function*() {
|
|
const memberSigninURL = yield this.member.fetchSigninUrl.perform();
|
|
|
|
this.set('signinUrl', memberSigninURL.url);
|
|
}).drop()
|
|
});
|