@@ -682,15 +682,6 @@ module.exports = function(User) {
682
682
}
683
683
} ;
684
684
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
-
694
685
// Make sure emailVerified is not set by creation
695
686
UserModel . beforeRemote ( 'create' , function ( ctx , user , next ) {
696
687
var body = ctx . req . body ;
@@ -818,6 +809,15 @@ module.exports = function(User) {
818
809
// Important: Operation hooks are inherited by subclassed models,
819
810
// therefore they must be registered outside of setup() function
820
811
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
+
821
821
// Delete old sessions once email is updated
822
822
User . observe ( 'before save' , function beforeEmailUpdate ( ctx , next ) {
823
823
if ( ctx . isNewInstance ) return next ( ) ;
0 commit comments