({ user, classroom, students })
| 33 | } |
| 34 | |
| 35 | constructor ({ user, classroom, students }) { |
| 36 | super(...arguments) |
| 37 | this.user = user |
| 38 | this.classroom = classroom |
| 39 | this.students = students |
| 40 | this.supermodel.trackRequest(this.user.fetch()) |
| 41 | this.utils = require('core/utils') |
| 42 | this.state = new State({ |
| 43 | emailSent: false, |
| 44 | passwordChanged: false, |
| 45 | newPassword: '', |
| 46 | errorMessage: '' |
| 47 | }) |
| 48 | this.fetchPrepaids() |
| 49 | this.listenTo(this.state, 'change', this.render) |
| 50 | this.listenTo(this.classroom, 'save-password:success', function () { |
| 51 | this.state.set({ passwordChanged: true, errorMessage: '' }) |
| 52 | }) |
| 53 | this.listenTo(this.classroom, 'save-password:error', function (error) { |
| 54 | if (error.message === 'Data matches schema from "not"') { |
| 55 | error.message = $.i18n.t('signup.invalid_password') |
| 56 | } |
| 57 | this.state.set({ errorMessage: error.message }) |
| 58 | }) |
| 59 | // TODO: Show an error. (password too short) |
| 60 | |
| 61 | __guard__(me.getClientCreatorPermissions(), x => x.then(() => (typeof this.render === 'function' ? this.render() : undefined))) |
| 62 | } |
| 63 | |
| 64 | onLoaded () { |
| 65 | this.prepaids.reset(this.prepaids.filter(prepaid => prepaid.status() === 'available')) |
nothing calls this directly
no test coverage detected