File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,8 @@ export const getTradeResult = ({commit}) => {
22
22
23
23
24
24
export const login = ( vueContext , loginData ) => {
25
- let password = loginData . password ;
26
- let username = loginData . username ;
27
- let rndUser = Math . random ( ) . toString ( 36 ) . substr ( 2 , 6 ) ;
28
- let rndPass = Math . random ( ) . toString ( 36 ) . substr ( 2 , 6 ) ;
29
- loginData . password = btoa ( btoa ( password + util . rndData + rndPass ) ) ;
30
- loginData . username = btoa ( btoa ( username + util . rndData + rndUser ) ) ;
25
+ loginData . password = util . randomCode ( loginData . password ) ;
26
+ loginData . username = util . randomCode ( loginData . username ) ;
31
27
32
28
return util . service . post ( "auth/login" , loginData )
33
29
. then ( response => {
@@ -60,6 +56,8 @@ export const userRegister = (vueContext, registerData) => {
60
56
if ( response ) {
61
57
return response ;
62
58
}
59
+ } ) . catch ( error => {
60
+ registerData = { } ;
63
61
} )
64
62
} ;
65
63
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ export const notify = {
17
17
}
18
18
} ;
19
19
20
+ export const randomCode = function ( data ) {
21
+ let rndKey = Math . random ( ) . toString ( 36 ) . substr ( 2 , 6 ) ;
22
+ return btoa ( btoa ( data + rndData + rndKey ) ) ;
23
+ } ;
24
+
20
25
export const service = {
21
26
22
27
get ( url ) {
You can’t perform that action at this time.
0 commit comments