This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
site-base/spark/resources/assets/js/settings/security/enable-two-factor-auth.js

40 lines
607 B
JavaScript
Raw Normal View History

2017-11-03 05:26:07 +00:00
module.exports = {
props: ['user'],
/**
* The component's data.
*/
data() {
return {
form: new SparkForm({
country_code: '',
phone: ''
})
}
},
/**
* Prepare the component.
*/
mounted() {
this.form.country_code = this.user.country_code;
this.form.phone = this.user.phone;
},
methods: {
/**
* Enable two-factor authentication for the user.
*/
enable() {
Spark.post('/settings/two-factor-auth', this.form)
.then(code => {
this.$parent.$emit('receivedTwoFactorResetCode', code);
Bus.$emit('updateUser');
});
}
}
};