-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor ES6 fixes + reset password page & component #129
- Loading branch information
1 parent
d55e62f
commit a255922
Showing
14 changed files
with
115 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
angular/app/components/reset-password/reset-password.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="ResetPassword-loader" layout="row" layout-align="center center"> | ||
<md-progress-circular md-mode="indeterminate" ng-if="!vm.isValidCode"></md-progress-circular> | ||
</div> | ||
|
||
<form ng-submit="vm.submit()" ng-show="vm.isValidCode"> | ||
<div> | ||
<md-input-container> | ||
<label>Password</label> | ||
<input type="password" ng-model="vm.password"> | ||
</md-input-container> | ||
</div> | ||
|
||
<div> | ||
<md-input-container> | ||
<label>Confirm Password</label> | ||
<input type="password" ng-model="vm.password_confirmation"> | ||
</md-input-container> | ||
</div> | ||
|
||
<md-button type="submit" class="md-primary md-raised">Submit</md-button> | ||
</form> |
47 changes: 47 additions & 0 deletions
47
angular/app/components/reset-password/reset-password.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class ResetPasswordController { | ||
constructor(API, ToastService, $state) { | ||
'ngInject'; | ||
|
||
this.API = API; | ||
this.$state = $state; | ||
this.ToastService = ToastService; | ||
|
||
this.password = ''; | ||
this.password_confirmation = ''; | ||
this.isValidCode = false; | ||
|
||
this.validateCode(); | ||
} | ||
|
||
validateCode() { | ||
let email = this.$state.params.email; | ||
let code = this.$state.params.code; | ||
|
||
this.API.all('auth/reset').get('check', { | ||
email, code | ||
}).then(() => { | ||
this.isValidCode = true; | ||
}); | ||
} | ||
|
||
reset() { | ||
let data = { | ||
email: this.$state.params.email, | ||
code: this.$state.params.code, | ||
password: this.password, | ||
password_confirmation: this.password_confirmation | ||
}; | ||
|
||
this.API.all('auth/reset').post(data).then(() => { | ||
this.ToastService.show('Password successfully changed'); | ||
this.$state.go('app.login'); | ||
}); | ||
} | ||
} | ||
|
||
export const ResetPasswordComponent = { | ||
templateUrl: './views/app/components/reset-password/reset-password.component.html', | ||
controller: ResetPasswordController, | ||
controllerAs: 'vm', | ||
bindings: {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.ResetPassword-loader{ | ||
min-height: 300px; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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">Reset Password</h1> | ||
|
||
<reset-password></reset-password> | ||
|
||
</div> | ||
</md-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/angular/app/components/reset-password.component.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ngDescribe({ | ||
name: 'Test reset-password component', | ||
modules: 'app', | ||
element: '<reset-password></reset-password>', | ||
tests: function (deps) { | ||
|
||
it('basic test', () => { | ||
// | ||
}); | ||
} | ||
}); |