@@ -7,6 +7,7 @@ require('./support');
77var loopback = require ( '../' ) ;
88var User , AccessToken ;
99var async = require ( 'async' ) ;
10+ var url = require ( 'url' ) ;
1011
1112describe ( 'User' , function ( ) {
1213 this . timeout ( 10000 ) ;
@@ -1700,6 +1701,29 @@ describe('User', function() {
17001701 expect ( result . email ) . to . not . have . property ( 'template' ) ;
17011702 } ) ;
17021703 } ) ;
1704+
1705+ it ( 'allows hash fragment in redirectUrl' , function ( ) {
1706+ return User . create ( { email :
'[email protected] ' , password :
'pass' } ) 1707+ . then ( function ( user ) {
1708+ var actualVerifyHref ;
1709+ return user . verify ( {
1710+ type : 'email' ,
1711+ to : user . email ,
1712+ 1713+ redirect : '#/some-path?a=1&b=2' ,
1714+ templateFn : function ( options , cb ) {
1715+ actualVerifyHref = options . verifyHref ;
1716+ cb ( null , 'dummy body' ) ;
1717+ } ,
1718+ } )
1719+ . then ( function ( ) { return actualVerifyHref ; } ) ;
1720+ } )
1721+ . then ( function ( verifyHref ) {
1722+ var parsed = url . parse ( verifyHref , true ) ;
1723+ expect ( parsed . query . redirect , 'redirect query' )
1724+ . to . equal ( '#/some-path?a=1&b=2' ) ;
1725+ } ) ;
1726+ } ) ;
17031727 } ) ;
17041728
17051729 describe ( 'User.confirm(options, fn)' , function ( ) {
0 commit comments