File tree Expand file tree Collapse file tree 6 files changed +57
-7
lines changed Expand file tree Collapse file tree 6 files changed +57
-7
lines changed Original file line number Diff line number Diff line change 1
1
var ApplicationController = Ember . Controller . extend ( {
2
2
isSignedIn : Ember . computed . bool ( 'user.isSignedIn' ) ,
3
+ hideNav : Ember . computed . match ( 'currentPath' , / ( s i g n i n | s i g n u p | f o r g o t t e n | r e s e t ) / ) ,
3
4
4
5
actions : {
5
6
toggleMenu : function ( ) {
Original file line number Diff line number Diff line change
1
+ import ajax from 'ghost/utils/ajax' ;
1
2
import styleBody from 'ghost/mixins/style-body' ;
2
3
3
4
var SignupRoute = Ember . Route . extend ( styleBody , {
4
- classNames : [ 'ghost-signup' ]
5
+ classNames : [ 'ghost-signup' ] ,
6
+
7
+ name : null ,
8
+ email : null ,
9
+ password : null ,
10
+
11
+ actions : {
12
+ signup : function ( ) {
13
+ var self = this ,
14
+ controller = this . get ( 'controller' ) ,
15
+ data = controller . getProperties ( 'name' , 'email' , 'password' ) ;
16
+
17
+ // TODO: Validate data
18
+
19
+ if ( data . name && data . email && data . password ) {
20
+ ajax ( {
21
+ url : '/ghost/signup/' ,
22
+ type : 'POST' ,
23
+ headers : {
24
+ 'X-CSRF-Token' : this . get ( 'csrf' )
25
+ } ,
26
+ data : data
27
+ } ) . then ( function ( resp ) {
28
+ if ( resp && resp . userData ) {
29
+ self . send ( 'signedIn' , resp . userData ) ;
30
+
31
+ self . notifications . clear ( ) ;
32
+
33
+ self . transitionTo ( 'posts' ) ;
34
+ } else {
35
+ self . transitionTo ( 'signin' ) ;
36
+ }
37
+ } , function ( resp ) {
38
+ self . notifications . showAPIError ( resp ) ;
39
+ } ) ;
40
+ } else {
41
+ this . notifications . showError ( 'Must provide name, email and password' ) ;
42
+ }
43
+ }
44
+ }
5
45
} ) ;
6
46
7
47
export default SignupRoute ;
Original file line number Diff line number Diff line change 10
10
11
11
<li id =" usermenu" class =" usermenu subnav" >
12
12
<a href =" javascript:void(0);" {{ action ' toggleMenu' }} class =" dropdown" >
13
+ {{ #if user.image }}
13
14
<img class =" avatar" {{ bind-attr src =" user.image" }} alt =" Avatar" />
15
+ {{ else }}
16
+ <img class =" avatar" src =" /shared/img/user-image.png" alt =" Avatar" />
17
+ {{ /if }}
14
18
<span class =" name" >{{ user.name }} </span >
15
19
</a >
16
20
{{!-- @TODO : add functionality to allow for dropdown to work --}}
Original file line number Diff line number Diff line change 1
- {{ #if isSignedIn }}
1
+ {{ #unless hideNav }}
2
2
{{ partial " navbar" }}
3
- {{ /if }}
3
+ {{ /unless }}
4
4
5
5
<main role =" main" id =" main" >
6
6
{{ ghost-notifications }}
Original file line number Diff line number Diff line change 1
1
<section class =" signup-box js-signup-box fade-in" >
2
2
<form id =" signup" class =" signup-form" method =" post" novalidate =" novalidate" >
3
3
<div class =" name-wrap" >
4
- < input class =" name" type =" text" placeholder =" Full Name" name =" name" autofocus autocorrect =" off" />
4
+ {{ input class =" name" type =" text" placeholder =" Full Name" name =" name" autofocus = " autofocus " autocorrect =" off" value = name }}
5
5
</div >
6
6
<div class =" email-wrap" >
7
- < input class =" email" type =" email" placeholder =" Email Address" name =" email" autocapitalize =" off" autocorrect =" off" />
7
+ {{ input class =" email" type =" email" placeholder =" Email Address" name =" email" autocapitalize =" off" autocorrect =" off" value = email }}
8
8
</div >
9
9
<div class =" password-wrap" >
10
- < input class =" password" type =" password" placeholder =" Password" name =" password" />
10
+ {{ input class =" password" type =" password" placeholder =" Password" name =" password" value = password }}
11
11
</div >
12
- <button class =" button-save" type =" submit" >Sign Up</button >
12
+ <button class =" button-save" type =" submit" {{ action " signup " }} >Sign Up</button >
13
13
</form >
14
14
</section >
Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ var middleware = {
79
79
}
80
80
redirect = '?r=' + encodeURIComponent ( reqPath ) ;
81
81
}
82
+
83
+ if ( subPath . indexOf ( '/ember' ) > - 1 ) {
84
+ return res . redirect ( config ( ) . paths . subdir + '/ghost/ember/signin' ) ;
85
+ }
86
+
82
87
return res . redirect ( config ( ) . paths . subdir + '/ghost/signin/' + redirect ) ;
83
88
} ) ;
84
89
}
You can’t perform that action at this time.
0 commit comments