Skip to content

Commit

Permalink
Step 18.49: Create Password
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and Dotan Simha committed Nov 22, 2016
1 parent 45c4c3e commit a603b2d
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions imports/ui/components/password/password.js
@@ -0,0 +1,56 @@
import angular from 'angular';
import angularMeteor from 'angular-meteor';
import uiRouter from 'angular-ui-router';

import { Accounts } from 'meteor/accounts-base';

import template from './password.html';

class Register {
constructor($scope, $reactive, $state) {
'ngInject';

this.$state = $state;

$reactive(this).attach($scope);

this.credentials = {
email: ''
};

this.error = '';
}

reset() {
Accounts.forgotPassword(this.credentials, this.$bindToContext((err) => {
if (err) {
this.error = err;
} else {
this.$state.go('parties');
}
}));
}
}

const name = 'password';

// create a module
export default angular.module(name, [
angularMeteor,
uiRouter
])
.component(name, {
template,
controllerAs: name,
controller: Register
})
.config(config);

function config($stateProvider) {
'ngInject';

$stateProvider.state('password', {
url: '/password',
template: '<password></password>'
});
}

0 comments on commit a603b2d

Please sign in to comment.