File tree 3 files changed +11
-14
lines changed
templates/javascript/controllers
3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,16 @@ angular.module('<%= scriptAppName %>')
9
9
$scope . submitted = true ;
10
10
11
11
if ( form . $valid ) {
12
- Auth . login ( 'local' , {
12
+ Auth . login ( {
13
13
email : $scope . user . email ,
14
14
password : $scope . user . password
15
15
} )
16
- . then ( function ( user ) {
17
- // Success , redirect to home
16
+ . then ( function ( ) {
17
+ // Logged in , redirect to home
18
18
$location . path ( '/' ) ;
19
19
} )
20
20
. catch ( function ( err ) {
21
- var err = err . data ;
21
+ err = err . data ;
22
22
$scope . errors . other = err . message ;
23
23
} ) ;
24
24
}
Original file line number Diff line number Diff line change @@ -5,14 +5,11 @@ angular.module('<%= scriptAppName %>')
5
5
$scope . menu = [ {
6
6
'title' : 'Home' ,
7
7
'link' : '/'
8
- } , {
9
- 'title' : 'About' ,
10
- 'link' : '#'
11
- } , {
12
- 'title' : 'Contact' ,
13
- 'link' : '#'
14
- } ] ;
15
- < % if ( mongo && mongoPassportUser ) { % >
8
+ } < % if ( mongoPassportUser ) { % > , {
9
+ 'title' : 'Settings' ,
10
+ 'link' : '/settings'
11
+ } < % } % > ] ;
12
+ < % if ( mongoPassportUser ) { % >
16
13
$scope . logout = function ( ) {
17
14
Auth . logout ( )
18
15
. then ( function ( ) {
Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ angular.module('<%= scriptAppName %>')
15
15
password : $scope . user . password
16
16
} )
17
17
. then ( function ( user ) {
18
- // Success , redirect to home
18
+ // Account created , redirect to home
19
19
$location . path ( '/' ) ;
20
20
} )
21
21
. catch ( function ( err ) {
22
22
var err = err . data ;
23
23
$scope . errors = { } ;
24
24
25
- // Update validity form fields that match the error fields
25
+ // Update validity of form fields that match the mongoose errors
26
26
angular . forEach ( err . errors , function ( error , field ) {
27
27
form [ field ] . $setValidity ( 'mongoose' , false ) ;
28
28
$scope . errors [ field ] = error . type ;
You can’t perform that action at this time.
0 commit comments