Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
tbfguest.tbf.ro
/
src
/
views
/
auth
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
Invitation.vue
| Size :
6.10
KB
Copy
<template> <div class="flex min-h-full flex-1 flex-col justify-center py-12 sm:px-6 lg:px-8 tbf-gradient animate-gradient"> <div class="sm:mx-auto sm:w-full sm:max-w-md"> <img class="mx-auto h-7 w-auto" src="@/assets/images/logo-tbf-white.svg" alt="Your Company" /> </div> <div class="mt-12 sm:mx-auto sm:w-full sm:max-w-[480px]"> <div class="bg-white px-6 py-12 shadow shadow-gray-400/20 sm:rounded-lg sm:px-12"> <div class="mt-2"> <p class="text-sm text-gray-500"> {{ user.first_name }}, ai fost invitat de către compania <span class="text-gray-900 font-medium">{{ instance.name }}</span> să acccesezi platforma <span class="text-gray-900 font-medium">TBF AI</span>. Stabilește o parolă sigură și accesează contul tău. </p> </div> <form class="space-y-6 mt-4" @submit.prevent="submitResetPassword"> <div> <label class="block text-sm font-medium leading-6 text-gray-900">Companie</label> <div class="mt-2"> <input type="text" disabled :value="instance.name" class="block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6 disabled:bg-gray-50 disabled:text-gray-600" /> </div> </div> <div> <label class="block text-sm font-medium leading-6 text-gray-900">Adresa de email</label> <div class="mt-2"> <input type="text" disabled :value="user.email" class="block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6 disabled:bg-gray-50 disabled:text-gray-600" /> </div> </div> <div> <div class="flex justify-between"> <label for="new-password" class="block text-sm font-medium leading-6 text-gray-900">Parola</label> <button type="button" class="text-sm text-gray-500 underline hover:text-blue-500" @click="toggleShowPassowrd"> {{ showPassword ? "Ascunde parola" : "Arată parola" }} </button> </div> <div class="mt-2 relative"> <input id="new-password" v-model="password" :type="showPassword ? 'text' : 'password'" name="new-password" autocomplete="new-password" :class="[ v$.password.$errors.length ? 'text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500' : 'text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-blue-500', ]" class="block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6" /> <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" v-if="v$.password.$errors.length"> <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512" class="h-5 w-5 text-red-500"> <path fill="currentColor" d="M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448zm0 480A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c-8.8 0-16 7.2-16 16V272c0 8.8 7.2 16 16 16s16-7.2 16-16V144c0-8.8-7.2-16-16-16zm24 224a24 24 0 1 0 -48 0 24 24 0 1 0 48 0z" /> </svg> </div> </div> </div> <div> <p class="mb-2 text-sm text-red-600" v-if="errorRegister">{{ errorRegister }}</p> <button type="submit" :disabled="loadingSubmit" class="flex w-full justify-center rounded-md bg-blue-500 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-blue-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500" :class="[{ 'disabled:bg-blue-400 disabled:cursor-not-allowed': loadingSubmit }]"> <LoaderTbf class="inline-block mr-2" color="text-white" v-if="loadingSubmit" /> Salvează și accesează contul </button> </div> </form> </div> </div> </div> </template> <script> import LoaderTbf from "@/components/public/LoadingTbf.vue"; import { useVuelidate } from "@vuelidate/core"; import { required } from "@vuelidate/validators"; export default { setup: () => ({ v$: useVuelidate() }), components: { LoaderTbf, }, data() { return { loadingSubmit: false, password: "", errorRegister: false, user: {}, instance: {}, invitedBy: {}, showPassword: false, }; }, validations() { return { password: { required }, }; }, async mounted() { if (!this.$route.query.token || !this.$route.query.user) { this.$router.push({ name: "not_found" }); } await this.getUserData(); }, methods: { toggleShowPassowrd() { this.showPassword = !this.showPassword; }, async getUserData() { await axios .get(`/auth/invitation?token=${this.$route.query.token}&user=${this.$route.query.user}`) .then(({ data }) => { this.user = data.user; this.instance = data.instance; this.invitedBy = data.invitedByUser; }) .catch(() => { this.$router.push({ name: "login" }); }); }, async submitResetPassword() { const isFormCorrect = await this.v$.$validate(); if (!isFormCorrect) { return; } this.loadingSubmit = true; this.errorRegister = false; axios .post(`/auth/reset-password`, { token: this.$route.query.token, email: this.user.email, password: this.password, password_confirmation: this.password, }) .then(() => { this.$auth .login({ data: { email: this.user.email, password: this.password, }, staySignedIn: true, fetchUser: true, }) .then(() => { const role = this.$auth.user().rights.role; if (role === "super_admin") { this.$router.push({ name: "admin_instances" }); } else { this.$router.push({ name: "home" }); } }); }) .catch((error) => { var responseError = error.response.data; this.loadingSubmit = false; this.errorRegister = responseError.message; }); }, }, }; </script>
Back