@@ -682,15 +682,6 @@ module.exports = function(User) {
682682 }
683683 } ;
684684
685- // Access token to normalize email credentials
686- UserModel . observe ( 'access' , function normalizeEmailCase ( ctx , next ) {
687- if ( ! ctx . Model . settings . caseSensitiveEmail && ctx . query . where &&
688- ctx . query . where . email && typeof ( ctx . query . where . email ) === 'string' ) {
689- ctx . query . where . email = ctx . query . where . email . toLowerCase ( ) ;
690- }
691- next ( ) ;
692- } ) ;
693-
694685 // Make sure emailVerified is not set by creation
695686 UserModel . beforeRemote ( 'create' , function ( ctx , user , next ) {
696687 var body = ctx . req . body ;
@@ -818,6 +809,15 @@ module.exports = function(User) {
818809 // Important: Operation hooks are inherited by subclassed models,
819810 // therefore they must be registered outside of setup() function
820811
812+ // Access token to normalize email credentials
813+ User . observe ( 'access' , function normalizeEmailCase ( ctx , next ) {
814+ if ( ! ctx . Model . settings . caseSensitiveEmail && ctx . query . where &&
815+ ctx . query . where . email && typeof ( ctx . query . where . email ) === 'string' ) {
816+ ctx . query . where . email = ctx . query . where . email . toLowerCase ( ) ;
817+ }
818+ next ( ) ;
819+ } ) ;
820+
821821 // Delete old sessions once email is updated
822822 User . observe ( 'before save' , function beforeEmailUpdate ( ctx , next ) {
823823 if ( ctx . isNewInstance ) return next ( ) ;
0 commit comments