Skip to content

Commit

Permalink
added forgot-password page & component #129
Browse files Browse the repository at this point in the history
  • Loading branch information
jadjoubran committed Apr 14, 2016
1 parent fd7b2c7 commit d55e62f
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<form ng-submit="vm.submit()">
<div>
<md-input-container>
<label>Email</label>
<input type="email" ng-model="vm.email">
</md-input-container>
</div>

<md-button type="submit" class="LoginForm-submit md-primary md-raised">Submit</md-button>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class ForgotPasswordController {
constructor(API, ToastService, $state) {
'ngInject';

this.API = API;
this.$state = $state;
this.ToastService = ToastService;

this.email = '';
}

submit() {
this.API.all('auth/forgot').post({
email: this.email
}).then(() => {
this.ToastService.show(`Please check your email for instructions on how to reset your password.`);
this.$state.go('app.landing');
});
}
}

export const ForgotPasswordComponent = {
templateUrl: './views/app/components/forgot-password/forgot-password.component.html',
controller: ForgotPasswordController,
controllerAs: 'vm',
bindings: {}
}
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions angular/app/pages/forgot-password/forgot-password.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<md-content class="Page-container">
<div layout="column" layout-align="center center">

<h1 class="md-headline">Forgot your password?</h1>

<forgot-password></forgot-password>

</div>
</md-content>
13 changes: 11 additions & 2 deletions angular/config/routes.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function RoutesConfig($stateProvider, $urlRouterProvider) {
})
.state('app.login', {
url: '/login',
data: {},//{auth: true} would require JWT auth for this route
data: {},
views: {
'main@': {
templateUrl: getView('login')
Expand All @@ -40,11 +40,20 @@ export function RoutesConfig($stateProvider, $urlRouterProvider) {
})
.state('app.register', {
url: '/register',
data: {},//{auth: true} would require JWT auth for this route
data: {},
views: {
'main@': {
templateUrl: getView('register')
}
}
})
.state('app.forgot_password', {
url: '/forgot-password',
data: {},
views: {
'main@': {
templateUrl: getView('forgot-password')
}
}
});
}
2 changes: 2 additions & 0 deletions angular/index.components.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {ForgotPasswordComponent} from './app/components/forgot-password/forgot-password.component';
import {LoginFormComponent} from './app/components/login-form/login-form.component';
import {RegisterFormComponent} from './app/components/register-form/register-form.component';

angular.module('app.components')
.component('forgotPassword', ForgotPasswordComponent)
.component('loginForm', LoginFormComponent)
.component('registerForm', RegisterFormComponent);

3 changes: 2 additions & 1 deletion app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

});

//public API routes
$api->group(['middleware' => ['api']], function ($api) {

$api->controller('auth', 'Auth\AuthController');

});

//protected routes with JWT (must be logged in)
//protected API routes with JWT (must be logged in)
$api->group(['middleware' => ['api', 'api.auth']], function ($api) {

});
11 changes: 11 additions & 0 deletions tests/angular/app/components/forgot-password.component.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ngDescribe({
name: 'Test forgot-password component',
modules: 'app',
element: '<forgot-password></forgot-password>',
tests: function (deps) {

it('basic test', () => {
//
});
}
});

0 comments on commit d55e62f

Please sign in to comment.