Allowance check
This commit is contained in:
@@ -13,25 +13,15 @@
|
||||
<br>-<b>+6 {{ $route.params.notel }}</b>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="showDebugOtp"
|
||||
class="alert alert-info"
|
||||
style="margin-bottom:20px;"
|
||||
>
|
||||
<div v-if="showDebugOtp" class="alert alert-info" style="margin-bottom:20px;">
|
||||
OTP local development: <b>{{ $route.params.debug_otp }}</b>
|
||||
</div>
|
||||
|
||||
<div class="justify-content-center d-flex" style="margin-top:20px;margin-bottom:20px;display: flex;flex-direction: row;justify-content: center;align-items: center;">
|
||||
<v-otp-input
|
||||
ref="otpInput"
|
||||
input-classes="otp-input"
|
||||
separator="-"
|
||||
:num-inputs="6"
|
||||
:should-auto-focus="true"
|
||||
:is-input-num="true"
|
||||
@on-change="handleOnChange"
|
||||
@on-complete="handleOnComplete"
|
||||
/>
|
||||
<div class="justify-content-center d-flex"
|
||||
style="margin-top:20px;margin-bottom:20px;display: flex;flex-direction: row;justify-content: center;align-items: center;">
|
||||
<v-otp-input ref="otpInput" input-classes="otp-input" separator="-" :num-inputs="6"
|
||||
:should-auto-focus="true" :is-input-num="true" @on-change="handleOnChange"
|
||||
@on-complete="handleOnComplete" />
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom:20px;">
|
||||
@@ -41,13 +31,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input
|
||||
ref="submitbtn"
|
||||
type="submit"
|
||||
class="btn btn-primary form-control"
|
||||
value="Sahkan & Teruskan"
|
||||
disabled
|
||||
/>
|
||||
<input ref="submitbtn" type="submit" class="btn btn-primary form-control" value="Sahkan & Teruskan"
|
||||
disabled />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -55,24 +40,19 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Countdown from '../../mycomponents/countdown.vue'
|
||||
|
||||
export default {
|
||||
components:{
|
||||
Countdown
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
return {
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showDebugOtp: function () {
|
||||
return process.env.NODE_ENV !== 'production' && !!this.$route.params.debug_otp;
|
||||
}
|
||||
},
|
||||
|
||||
created: function(){
|
||||
created: function () {
|
||||
console.log(this.$route.params.notel);
|
||||
},
|
||||
methods: {
|
||||
@@ -87,59 +67,56 @@ export default {
|
||||
handleClearInput() {
|
||||
this.$refs.otpInput.clearInput();
|
||||
},
|
||||
resendVerify: function(){
|
||||
axios.post(config.API+'voter/login', {
|
||||
'no_kp' : this.user.no_kp
|
||||
resendVerify: function () {
|
||||
var vm = this;
|
||||
axios.post(config.API + 'voter/login', {
|
||||
no_kp: this.$route.params.nokp
|
||||
})
|
||||
.then(response => {
|
||||
this.stopLoading();
|
||||
if (this.util.showResult(response, 'success')) {
|
||||
// this.$router.push({ name: 'Voter Verify',params: {'nokp' : response.data.nokp,'notel' : response.data.notel} })
|
||||
this.$refs.countdown.restarttimer();
|
||||
console.log('resend verify');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
vm.stopLoading();
|
||||
this.util.showResult(error, 'error');
|
||||
})
|
||||
.then(function (response) {
|
||||
if (vm.util.showResult(response, 'success')) {
|
||||
console.log('resend verify');
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm.util.showResult(error, 'error');
|
||||
});
|
||||
},
|
||||
startLoading: function () {
|
||||
this.util.notify('Logging in', 'loading');
|
||||
this.loading = true;
|
||||
},
|
||||
this.util.notify('Logging in', 'loading');
|
||||
this.loading = true;
|
||||
},
|
||||
stopLoading: function () {
|
||||
$.notifyClose();
|
||||
this.loading = false;
|
||||
},
|
||||
$.notifyClose();
|
||||
this.loading = false;
|
||||
},
|
||||
login: function () {
|
||||
if (this.loading) return;
|
||||
if (this.loading) return;
|
||||
|
||||
let vm = this;
|
||||
let vm = this;
|
||||
|
||||
this.startLoading();
|
||||
console.log('OTP INPUT : ');
|
||||
let otp = this.mergeOTP(this.$refs.otpInput.otp);
|
||||
console.log(otp);
|
||||
axios.post(config.API+'voter/verify', {
|
||||
'no_kp' : this.$route.params.nokp,
|
||||
'token' : otp
|
||||
})
|
||||
.then(response => {
|
||||
vm.stopLoading();
|
||||
if (this.util.showResult(response, 'success')) {
|
||||
localStorage['Access Token'] = `Bearer ${response.data.token}`;
|
||||
this.util.setAuthorization();
|
||||
vm.$router.push({name: 'Voter Home'});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
vm.stopLoading();
|
||||
this.util.showResult(error, 'error');
|
||||
})
|
||||
this.startLoading();
|
||||
console.log('OTP INPUT : ');
|
||||
let otp = this.mergeOTP(this.$refs.otpInput.otp);
|
||||
console.log(otp);
|
||||
axios.post(config.API + 'voter/verify', {
|
||||
'no_kp': this.$route.params.nokp,
|
||||
'token': otp
|
||||
})
|
||||
.then(response => {
|
||||
vm.stopLoading();
|
||||
if (this.util.showResult(response, 'success')) {
|
||||
localStorage['Access Token'] = `Bearer ${response.data.token}`;
|
||||
this.util.setAuthorization();
|
||||
vm.$router.push({ name: 'Voter Home' });
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
vm.stopLoading();
|
||||
this.util.showResult(error, 'error');
|
||||
})
|
||||
|
||||
},
|
||||
mergeOTP: function(OTP){
|
||||
},
|
||||
mergeOTP: function (OTP) {
|
||||
return OTP.join('');
|
||||
},
|
||||
},
|
||||
@@ -155,10 +132,12 @@ export default {
|
||||
border-radius: 4px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
text-align: center;
|
||||
&.error {
|
||||
border: 1px solid red !important;
|
||||
}
|
||||
}
|
||||
|
||||
.otp-input.error {
|
||||
border: 1px solid red !important;
|
||||
}
|
||||
|
||||
.otp-input::-webkit-inner-spin-button,
|
||||
.otp-input::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
|
||||
Reference in New Issue
Block a user