mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
243 lines
7.6 KiB
243 lines
7.6 KiB
4 years ago
|
<template>
|
||
|
<v-container class="text-center">
|
||
|
<v-row align="center">
|
||
|
<v-col class="col-md-8 offset-md-2">
|
||
2 years ago
|
<v-tabs v-model="tabs1.tab" background-color="" class="elevation-2">
|
||
3 years ago
|
<v-tabs-slider />
|
||
4 years ago
|
|
||
2 years ago
|
<v-tab v-for="(t, i) in tabs1.tabs" :key="i" :href="`#tab-${i}`">
|
||
3 years ago
|
<span class="caption text-capitalize">{{ t.title }}</span>
|
||
4 years ago
|
</v-tab>
|
||
|
|
||
2 years ago
|
<v-tab-item v-for="(t, i) in tabs1.tabs" :key="i" :value="'tab-' + i">
|
||
|
<v-card v-if="t.type === 'password'" class="py-10" flat tile>
|
||
|
<br />
|
||
4 years ago
|
<div v-if="isAdmin">
|
||
|
<h1>You are an Admin too!</h1>
|
||
2 years ago
|
<h2 class="title is-2">You are admin as well</h2>
|
||
|
<router-link to="/user/admin"> User list </router-link>
|
||
4 years ago
|
</div>
|
||
|
|
||
|
<v-row align="center">
|
||
|
<v-col md="8" offset-md="2">
|
||
3 years ago
|
<!-- <p class="title">
|
||
3 years ago
|
Change Password
|
||
3 years ago
|
</p>-->
|
||
4 years ago
|
|
||
|
<div>
|
||
3 years ago
|
<v-alert v-model="formUtil.formErr" type="error" dismissible>
|
||
|
{{ formUtil.formErrMsg }}
|
||
4 years ago
|
</v-alert>
|
||
|
</div>
|
||
|
|
||
|
<v-card class="pa-5 elevation-10" color="">
|
||
3 years ago
|
<v-form ref="formType" v-model="valid" lazy-validation>
|
||
4 years ago
|
<v-text-field
|
||
3 years ago
|
v-model="passwordDetails.currentPassword"
|
||
3 years ago
|
dense
|
||
|
class="caption"
|
||
4 years ago
|
name="input-10-2"
|
||
|
label="Currrent password"
|
||
|
:append-icon="e3 ? 'visibility' : 'visibility_off'"
|
||
|
:rules="formRules.password[0]"
|
||
|
:type="e3 ? 'password' : 'text'"
|
||
3 years ago
|
@click:append="() => (e3 = !e3)"
|
||
|
/>
|
||
4 years ago
|
|
||
|
<v-text-field
|
||
3 years ago
|
v-model="passwordDetails.newPassword"
|
||
3 years ago
|
dense
|
||
|
class="caption"
|
||
4 years ago
|
name="input-10-2"
|
||
|
label="New password"
|
||
|
:append-icon="e4 ? 'visibility' : 'visibility_off'"
|
||
|
:rules="formRules.password[1]"
|
||
|
:type="e4 ? 'password' : 'text'"
|
||
3 years ago
|
@click:append="() => (e4 = !e4)"
|
||
|
/>
|
||
4 years ago
|
|
||
|
<v-text-field
|
||
3 years ago
|
v-model="passwordDetails.verifyPassword"
|
||
3 years ago
|
dense
|
||
|
class="caption"
|
||
4 years ago
|
name="input-10-2"
|
||
|
label="Confirm new password"
|
||
|
:append-icon="e5 ? 'visibility' : 'visibility_off'"
|
||
|
:rules="formRules.password[2]"
|
||
|
:type="e5 ? 'password' : 'text'"
|
||
3 years ago
|
@click:append="() => (e5 = !e5)"
|
||
|
/>
|
||
4 years ago
|
|
||
2 years ago
|
<v-btn class="caption" color="primary" :disabled="!valid" @click="resetUserPassword">
|
||
4 years ago
|
SAVE PASSWORD
|
||
|
</v-btn>
|
||
|
</v-form>
|
||
|
</v-card>
|
||
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-card>
|
||
|
</v-tab-item>
|
||
|
</v-tabs>
|
||
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
2 years ago
|
import { isEmail } from '@/helpers';
|
||
3 years ago
|
|
||
|
export default {
|
||
|
directives: {},
|
||
|
components: {},
|
||
3 years ago
|
validate({ params }) {
|
||
2 years ago
|
return true;
|
||
3 years ago
|
},
|
||
|
props: {},
|
||
3 years ago
|
data() {
|
||
3 years ago
|
return {
|
||
|
user: {
|
||
2 years ago
|
provider: 'local',
|
||
3 years ago
|
},
|
||
|
tabs: 3,
|
||
|
tabs1: {
|
||
|
tab: null,
|
||
2 years ago
|
tabs: [
|
||
|
{
|
||
|
type: 'password',
|
||
|
title: 'Change Password',
|
||
|
},
|
||
|
],
|
||
3 years ago
|
},
|
||
4 years ago
|
|
||
3 years ago
|
subscriptions: [],
|
||
4 years ago
|
|
||
3 years ago
|
passwordDetails: {
|
||
|
newPassword: null,
|
||
|
verifyPassword: null,
|
||
2 years ago
|
currentPassword: null,
|
||
3 years ago
|
},
|
||
|
formUtil: {
|
||
|
formErr: false,
|
||
2 years ago
|
formErrMsg: '',
|
||
3 years ago
|
},
|
||
|
e3: true,
|
||
|
e4: true,
|
||
|
e5: true,
|
||
|
valid: true,
|
||
|
formRules: {
|
||
|
email: [
|
||
3 years ago
|
// E-mail is required
|
||
|
v => !!v || this.$t('msg.error.signUpRules.emailReqd'),
|
||
|
// E-mail must be valid
|
||
2 years ago
|
v => isEmail(v) || this.$t('msg.error.signUpRules.emailInvalid'),
|
||
3 years ago
|
],
|
||
|
password: [
|
||
3 years ago
|
// Current Password
|
||
|
[
|
||
|
// Password is required
|
||
2 years ago
|
v => !!v || this.$t('msg.error.signUpRules.passwdRequired'),
|
||
3 years ago
|
],
|
||
|
// New Password
|
||
|
[
|
||
|
// Password is required
|
||
|
v => !!v || this.$t('msg.error.signUpRules.passwdRequired'),
|
||
|
// You password must be atleast 8 characters
|
||
2 years ago
|
v => (v && v.length >= 8) || this.$t('msg.error.signUpRules.passwdLength'),
|
||
3 years ago
|
],
|
||
|
// Confirm Password
|
||
|
[
|
||
|
// Password is required
|
||
|
v => !!v || this.$t('msg.error.signUpRules.passwdRequired'),
|
||
|
// TODO: i18n
|
||
|
v => v === this.passwordDetails.newPassword || 'Confirm password should match',
|
||
|
// You password must be atleast 8 characters
|
||
2 years ago
|
v => (v && v.length >= 8) || this.$t('msg.error.signUpRules.passwdLength'),
|
||
|
],
|
||
|
],
|
||
|
},
|
||
|
};
|
||
3 years ago
|
},
|
||
3 years ago
|
head() {
|
||
2 years ago
|
return {};
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
3 years ago
|
isAdmin() {
|
||
3 years ago
|
if (this.$store.state.users.user) {
|
||
|
// console.log(this.$store.state.users.user.roles.indexOf('creator'));
|
||
2 years ago
|
return 'creator' in this.$store.state.users.user.roles;
|
||
4 years ago
|
}
|
||
2 years ago
|
return false;
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
isEmailAuth() {
|
||
3 years ago
|
if (this.$store.state.users.user) {
|
||
|
// console.log(this.$store.state.users.user.roles.indexOf('creator'));
|
||
2 years ago
|
return this.$store.state.users.user.provider === 'local';
|
||
4 years ago
|
}
|
||
2 years ago
|
return false;
|
||
|
},
|
||
3 years ago
|
},
|
||
|
watch: {},
|
||
2 years ago
|
created() {},
|
||
3 years ago
|
mounted() {
|
||
2 years ago
|
this.getSubscriptions();
|
||
3 years ago
|
},
|
||
2 years ago
|
beforeDestroy() {},
|
||
3 years ago
|
methods: {
|
||
3 years ago
|
test() {
|
||
3 years ago
|
// console.log('test method');
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
async resetUserPassword(e) {
|
||
2 years ago
|
e.preventDefault();
|
||
3 years ago
|
if (this.$refs.formType[0].validate()) {
|
||
3 years ago
|
try {
|
||
2 years ago
|
await this.$api.auth.passwordChange({
|
||
|
currentPassword: this.passwordDetails.currentPassword,
|
||
|
newPassword: this.passwordDetails.newPassword,
|
||
|
});
|
||
|
this.$toast.success('Password changed successfully. Please login again.').goAway(3000);
|
||
|
this.$refs.formType[0].reset();
|
||
|
await this.$store.dispatch('users/ActSignOut');
|
||
|
this.$router.push('/user/authentication/signin');
|
||
3 years ago
|
} catch (e) {
|
||
2 years ago
|
this.$toast.error(await this._extractSdkResponseErrorMsg(e)).goAway(3000);
|
||
3 years ago
|
return;
|
||
4 years ago
|
}
|
||
|
}
|
||
|
},
|
||
3 years ago
|
|
||
2 years ago
|
async getSubscriptions(e) {},
|
||
3 years ago
|
},
|
||
2 years ago
|
beforeCreated() {},
|
||
|
destroy() {},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
2 years ago
|
<style scoped></style>
|
||
4 years ago
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
3 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
4 years ago
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|