44 <el-col :span =" 10" >
55 <el-card class =" box-card" v-if =" withLogin" >
66 <div class =" text item" >
7- <el-form :model =" form" :rules =" rules" :inline =" inline" ref =" loginForm" @submit.prevent.native =" submitForm" >
7+ <el-form
8+ :model =" form"
9+ :rules =" rules"
10+ :inline =" inline"
11+ ref =" loginForm"
12+ @submit.prevent.native =" submitForm"
13+ >
814 <el-form-item v-if =" withId" :label =" $t('login.id')" prop =" id" >
915 <el-input
1016 type =" text"
4248 </el-row >
4349 <el-row type =" flex" class =" row-index alert-row" justify =" center" >
4450 <el-col :span =" 10" >
45- <el-alert type =" error" v-if =" error" :closable =" false" >{{ error }}
46- <div style =" margin-top :10px ;" v-if =" retryUrl" >
51+ <el-alert type =" error" v-if =" error" :closable =" false"
52+ >{{ error }}
53+ <div style =" margin-top : 10px " v-if =" retryUrl" >
4754 <i18n v-if =" retryUrl" path =" login.retry" >
48- <router-link :to =" retryUrl" >{{ $t(' login.here' ) }}</router-link >
55+ <router-link :to =" retryUrl" >{{ $t(" login.here" ) }}</router-link >
4956 </i18n >
5057 </div >
5158 </el-alert >
6168</template >
6269
6370<script >
64- import sha256 from ' crypto-js/sha256' ;
71+ import sha256 from " crypto-js/sha256" ;
6572import router from " ../router" ;
6673import APIService from " @/services/APIService.js" ;
6774
@@ -70,22 +77,22 @@ export default {
7077 return {
7178 form: {
7279 id: " " ,
73- token: " "
80+ token: " " ,
7481 },
7582 withId: false ,
7683 withLogin: true ,
7784 retryUrl: undefined ,
7885 submitted: false ,
7986 loading: false ,
8087 returnUrl: " " ,
81- error: " "
88+ error: " " ,
8289 };
8390 },
8491 computed: {
85- inline : function () {
86- // Show the form inline (on a single row) when just asking for the master
92+ inline : function () {
93+ // Show the form inline (on a single row) when just asking for the admin
8794 // token, but show it on multiple rows when also asking for the login id.
88- return ! this .withId
95+ return ! this .withId ;
8996 },
9097 rules () {
9198 // Use dynamic rules so that we only check the entered id when we are
@@ -94,17 +101,17 @@ export default {
94101 id: [
95102 {
96103 required: this .withId ,
97- validator: this .checkId
98- }
104+ validator: this .checkId ,
105+ },
99106 ],
100107 token: [
101108 {
102109 required: true ,
103- validator: this .checkToken
104- }
105- ]
106- }
107- }
110+ validator: this .checkToken ,
111+ },
112+ ],
113+ };
114+ },
108115 },
109116 created () {
110117 this .returnUrl = this .$route .query .returnUrl || " /" ;
@@ -137,7 +144,7 @@ export default {
137144 this .postLogin (true );
138145 } else {
139146 if (this .$route .query .withId ) {
140- // Configure the login form for id/password mode instead of master token
147+ // Configure the login form for id/password mode instead of admin token
141148 // mode.
142149 this .withId = true ;
143150 }
@@ -157,20 +164,15 @@ export default {
157164 if (value === " " ) {
158165 callback (new Error (this .$t (" login.required" )));
159166 } else {
160- if (
161- value
162- .toLowerCase ()
163- .replace (/ -/ gi , " " )
164- .indexOf (" correcthorsebatterystaple" ) === 0
165- ) {
167+ if (value .toLowerCase ().replace (/ -/ gi , " " ).indexOf (" correcthorsebatterystaple" ) === 0 ) {
166168 callback (new Error (this .$t (" login.copied" )));
167169 } else {
168170 callback ();
169171 }
170172 }
171173 },
172174 submitForm () {
173- this .$refs [" loginForm" ].validate (valid => {
175+ this .$refs [" loginForm" ].validate (( valid ) => {
174176 if (valid) {
175177 this .login ();
176178 } else {
@@ -188,13 +190,13 @@ export default {
188190 // that (shouldn't be but) might be the same password the user uses for
189191 // other systems.
190192 let hashedPassword = sha256 (this .form .token );
191- APIService .login (hashedPassword, this .form .id ).then (success => {
192- this .postLogin (success)
193+ APIService .login (hashedPassword, this .form .id ).then (( success ) => {
194+ this .postLogin (success);
193195 });
194196 } else {
195- // Handle master token based login
196- APIService .login (this .form .token ).then (success => {
197- this .postLogin (success)
197+ // Handle admin token based login
198+ APIService .login (this .form .token ).then (( success ) => {
199+ this .postLogin (success);
198200 });
199201 }
200202 },
@@ -212,8 +214,8 @@ export default {
212214 : this .$t (" errors." + error .code );
213215 }
214216 }
215- }
216- }
217+ },
218+ },
217219};
218220 </script >
219221
0 commit comments