File tree 4 files changed +4
-2
lines changed
4 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1436,7 +1436,7 @@ let Model = {
1436
1436
let loginFiled = await Settings . get ( "CORE_LOGIN_FIELD" ) || "phone" ;
1437
1437
const phone = order . customer . phone . code + order . customer . phone . number + order . customer . phone . additionalNumber ;
1438
1438
const login = loginFiled === "phone" ? phone . replace ( / \D / g, "" ) : `${ phone } @localhost` ;
1439
- user = await User . findOne ( criteriaOne ) ;
1439
+ user = await User . findOne ( { login } ) ;
1440
1440
if ( ! user ) {
1441
1441
user = await User . create ( {
1442
1442
firstName : order . customer . name ,
Original file line number Diff line number Diff line change @@ -1729,7 +1729,7 @@ let Model = {
1729
1729
const phone = order . customer . phone . code + order . customer . phone . number + order . customer . phone . additionalNumber ;
1730
1730
const login = loginFiled === "phone" ? phone . replace ( / \D / g, "" ) : `${ phone } @localhost` ;
1731
1731
1732
- user = await User . findOne ( criteriaOne ) ;
1732
+ user = await User . findOne ( { login } ) ;
1733
1733
1734
1734
if ( ! user ) {
1735
1735
user = await User . create ( {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ let attributes = {
36
36
login : {
37
37
type : 'string' ,
38
38
required : true ,
39
+ unique : true ,
39
40
isNotEmptyString : true
40
41
} ,
41
42
firstName : {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ let attributes = {
28
28
login : {
29
29
type : 'string' ,
30
30
required : true ,
31
+ unique : true ,
31
32
isNotEmptyString : true
32
33
} as unknown as string ,
33
34
You can’t perform that action at this time.
0 commit comments