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.

434 lines
15 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div
  3. class="tw-bg-white md:tw-rounded-[24px] md:tw-mt-[30px] md:tw-pt-[60px] md:tw-pb-[150px] md:tw-px-[30px]"
  4. >
  5. <div v-if="getPath == null">
  6. <p class="tw-text-[26px] tw-font-bold tw-mb-[20px] md:tw-text-[18px]">
  7. {{ $t("Forgot Password") }}
  8. </p>
  9. <p class="tw-body-3 tw-text-black tw-mb-[24px]">
  10. {{
  11. $t(
  12. "Dont worry! It happens. Please enter the address associated with your account."
  13. )
  14. }}
  15. </p>
  16. <div v-if="wrongMessageActive" class="warning--text text-size-14 ps-1 mb-3">
  17. {{ $t('The Email entered is incorrect') }}
  18. </div>
  19. <v-form v-model="resendValid">
  20. <v-text-field
  21. v-model="Email"
  22. background-color="neutrals darken-1"
  23. :label="this.$t('Email')"
  24. placeholder=""
  25. filled
  26. rounded
  27. dense
  28. single-line
  29. :rules="[rules.email, rules.require]"
  30. ></v-text-field>
  31. </v-form>
  32. <div class="md:tw-flex md:tw-justify-center md:tw-items-center">
  33. <button
  34. @click="sendForgotMail"
  35. :disabled="!resendValid"
  36. :class="[
  37. 'tw-block tw-w-full tw-py-[10px] tw-rounded-[16px] tw-border tw-border-solid tw-body-3 tw-font-normal tw-transition-all tw-duration-200 tw-ease-in-out',
  38. resendValid
  39. ? 'tw-text-white tw-bg-primary-default tw-border-primary-default'
  40. : 'tw-text-base-disable tw-bg-neutral-100 tw-border-neutral-100',
  41. ]"
  42. >
  43. {{ $t("Reset Password")
  44. }}<span v-if="disableBtn">({{ this.countdown }})</span>
  45. </button>
  46. </div>
  47. </div>
  48. <div v-if="getPath != null && resetSuccess == false">
  49. <p class="title">{{ $t("Reset Password") }}</p>
  50. <v-form v-model="resetValid">
  51. <v-text-field
  52. v-model="userData.Password"
  53. background-color="neutrals darken-1"
  54. :label="this.$t('Password') + '*'"
  55. :type="showPass ? 'text' : 'password'"
  56. placeholder=""
  57. filled
  58. rounded
  59. dense
  60. single-line
  61. persistent-hint
  62. :rules="[rules.checkPassword, rules.require]"
  63. :hint="
  64. this.$t(
  65. 'Passwords must be 8-20 characters with at least 1 number, 1 lower case letter and 1 upper case letter'
  66. )
  67. "
  68. :append-icon="showPass ? 'mdi-eye' : 'mdi-eye-off'"
  69. @click:append="showPass = !showPass"
  70. ></v-text-field>
  71. <v-text-field
  72. v-model="userConfirmPass"
  73. background-color="neutrals darken-1"
  74. :label="this.$t('Confirm Password') + '*'"
  75. :type="showConfirmPass ? 'text' : 'password'"
  76. placeholder=""
  77. filled
  78. rounded
  79. dense
  80. single-line
  81. :rules="[rules.checkPassword, rules.require, rules.confirmPass]"
  82. :append-icon="showConfirmPass ? 'mdi-eye' : 'mdi-eye-off'"
  83. @click:append="showConfirmPass = !showConfirmPass"
  84. ></v-text-field>
  85. </v-form>
  86. <div class="md:tw-flex md:tw-justify-center md:tw-items-center">
  87. <button
  88. @click="resetUserPass"
  89. :class="[
  90. 'tw-block tw-w-full tw-py-[10px] tw-rounded-[16px] tw-border tw-border-solid tw-body-3 tw-font-normal tw-transition-all tw-duration-200 tw-ease-in-out tw-text-white tw-bg-primary-default tw-border-primary-default']"
  91. >
  92. {{ $t("Reset Password") }}
  93. </button>
  94. </div>
  95. </div>
  96. <div v-if="resetSuccess">
  97. <p class="title">{{ $t("Password Reset") }}</p>
  98. <p class="neutrals--text text--darken-5 text-size-14">
  99. {{ $t("Congrats! Your password has been successfully reset") }}
  100. </p>
  101. <nuxt-link :to="localePath('/')">
  102. <v-btn
  103. @click="redirectHome"
  104. width="100%"
  105. color="primary"
  106. class="border-radius-16 mt-4"
  107. >
  108. <span class="text-capitalize">{{ $t("Explore with ShowEasy") }}</span>
  109. </v-btn>
  110. </nuxt-link>
  111. <v-spacer class="d-flex justify-center mt-5">
  112. <span
  113. class="text-size-12 primary--text"
  114. v-html="$t('Go to ShowEasy in sec', { second: this.countdown })"
  115. ></span>
  116. </v-spacer>
  117. </div>
  118. <v-dialog v-model="dialog" :width="$vuetify.breakpoint.smAndUp ? 423 : 294"
  119. @click:outside="colseDialog()">
  120. <v-card class="tw-p-[30px]" :height="$vuetify.breakpoint.smAndUp ? 289 : 290">
  121. <v-spacer class="d-flex align-center tw-justify-between tw-mb-[30px]">
  122. <div class="tw-text-[20px] tw-font-bold tw-text-black">
  123. {{ $t("Verify your email") }}
  124. </div>
  125. <v-btn @click="colseDialog()" icon>
  126. <v-icon> mdi-close </v-icon>
  127. </v-btn>
  128. </v-spacer>
  129. <v-spacer class="tw-mb-[40px]">
  130. <div class="tw-text-[16px] tw-text-neutrals-800">
  131. {{ $t("Oops! Seems like you haven't verified your email,please click the button below to resend a verification email.")}}
  132. </div>
  133. </v-spacer>
  134. <button @click="resendVerifyEmail()" class="tw-bg-primary-1 hover:tw-bg-primary-light tw-text-white tw-text-[18px] tw-rounded-[16px] tw-px-[77px] tw-py-[13px]">
  135. {{ $t("Resend verification email") }}
  136. </button>
  137. <!-- <v-btn @click="resendVerifyEmail" class="primary tw-text-[18px] tw-w-auto" rounded
  138. :disabled="countdown > 0">
  139. <span v-if="countdown > 0">
  140. {{ `(${this.countdown})` }}
  141. </span>
  142. </v-btn> -->
  143. </v-card>
  144. </v-dialog>
  145. <v-dialog v-model="deleteDialog" :width="$vuetify.breakpoint.smAndUp ? 423 : 294"
  146. @click:outside="colseDialog()">
  147. <v-card class="tw-p-[30px]" :height="$vuetify.breakpoint.smAndUp ? 289 : 290">
  148. <v-spacer class="d-flex tw-justify-between align-center tw-mb-[30px]">
  149. <div class="tw-text-[20px] tw-text-black tw-font-bold">
  150. {{ $t("Reactivate your account") }}
  151. </div>
  152. <v-btn @click="colseDialog()" icon>
  153. <v-icon> mdi-close </v-icon>
  154. </v-btn>
  155. </v-spacer>
  156. <v-spacer class="tw-mb-[40px]">
  157. <div class="tw-text-[16px] tw-text-neutrals-800 tw-font-bold">
  158. {{ $t("Welcome back!")}}
  159. </div>
  160. <div class="tw-text-[16px] tw-text-neutrals-800">
  161. {{ $t("Looks like your account has been deactivated.")}}
  162. <br />
  163. {{ $t("Would you like to reactivate this account?")}}
  164. </div>
  165. </v-spacer>
  166. <button @click="ReactivateAccount()" class="tw-bg-primary-1 tw-text-white hover:tw-bg-primary-light tw-text-[18px] tw-rounded-[16px] tw-px-[86px] tw-py-[13px]">
  167. {{ $t("Reactivate my account") }}
  168. </button>
  169. <!-- <v-btn class="primary tw-w-auto" rounded
  170. :disabled="countdown > 0">
  171. <span v-if="countdown > 0">
  172. {{ `(${this.countdown})` }}
  173. </span>
  174. </v-btn> -->
  175. </v-card>
  176. </v-dialog>
  177. <v-dialog v-model="chackMailDialog" :width="$vuetify.breakpoint.smAndUp ? 463 : 294"
  178. @click:outside="colseDialog()">
  179. <v-card class="tw-p-[30px]" :height="$vuetify.breakpoint.smAndUp ? 289 : 290">
  180. <v-spacer class="d-flex tw-justify-between align-center tw-mb-[30px]">
  181. <div class="tw-text-[20px] tw-text-black tw-font-bold">
  182. {{ $t("Check your email") }}
  183. </div>
  184. <v-btn @click="colseDialog()" icon>
  185. <v-icon> mdi-close </v-icon>
  186. </v-btn>
  187. </v-spacer>
  188. <v-spacer class="tw-mb-[40px]">
  189. <div class="tw-text-[16px] tw-text-neutrals-800 tw-font-bold">
  190. {{ $t("We've sent a password reset link to")}}
  191. </div>
  192. <div class="tw-text-[16px] tw-text-primary-1">
  193. {{ Email }}
  194. </div>
  195. <div class="tw-text-[16px] tw-text-neutrals-800 tw-font-bold">
  196. {{ $t("Please tap the link inside that email to continue.")}}
  197. </div>
  198. </v-spacer>
  199. <button @click="colseDialog()" class="tw-bg-primary-1 tw-text-white hover:tw-bg-primary-light tw-text-[18px] tw-rounded-[16px] tw-px-[169px] tw-py-[13px]">
  200. {{ $t("OK") }}
  201. </button>
  202. <!-- <v-btn class="primary tw-w-auto" rounded
  203. :disabled="countdown > 0">
  204. <span v-if="countdown > 0">
  205. {{ `(${this.countdown})` }}
  206. </span>
  207. </v-btn> -->
  208. </v-card>
  209. </v-dialog>
  210. </div>
  211. </template>
  212. <script>
  213. export default {
  214. name: "Forgot",
  215. layout: "login",
  216. auth: false,
  217. data() {
  218. return {
  219. showPass: false,
  220. showConfirmPass: false,
  221. resendValid: false,
  222. resetValid: false,
  223. disableBtn: false,
  224. resetSuccess: false,
  225. countdown: 5,
  226. Email: "",
  227. userConfirmPass: "",
  228. userData: {
  229. //user_id: "",
  230. //auth_code: "",
  231. Password: "",
  232. },
  233. result: "",
  234. getPath: null,
  235. rules: {
  236. require: (value) => !!value || this.$t("Required."),
  237. email: (v) =>
  238. /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/.test(
  239. v
  240. ) || this.$t("Invalid email"),
  241. checkPassword: (v) =>
  242. (/(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])/.test(v) &&
  243. v.length >= 8 &&
  244. v.length <= 20) ||
  245. this.$t(
  246. "Passwords must be 8-20 characters with at least 1 number, 1 lower case letter and 1 upper case letter"
  247. ),
  248. confirmPass: (v) =>
  249. v === this.userData.Password ||
  250. this.$t("Your password and confirmation password do not match"),
  251. },
  252. dialog: false,
  253. deleteDialog: false,
  254. wrongMessageActive: false,
  255. chackMailDialog: false,
  256. };
  257. },
  258. created(){
  259. this.$auth.$storage.removeUniversal('userPassword');
  260. this.$auth.$storage.removeUniversal('userAccount');
  261. this.getPAth();
  262. },
  263. methods: {
  264. colseDialog(){
  265. this.dialog = false;
  266. if(this.dialog == false){
  267. this.resendValid = true;
  268. }
  269. this.deleteDialog = false;
  270. if(this.deleteDialog == false){
  271. this.resendValid = true;
  272. }
  273. this.chackMailDialog = false;
  274. if(this.chackMailDialog == false){
  275. this.resendValid = true;
  276. }
  277. },
  278. getPAth(){
  279. let vm = this;
  280. if (this.$route.query.Email) {
  281. vm.getPath = vm.$route.query.Email;
  282. }else{
  283. vm.getPath = null;
  284. }
  285. },
  286. sendForgotMail() {
  287. this.countdown = 60;
  288. this.$axios
  289. .post(`/trending/api/Signup/SendForgotMail?Email=${this.Email}`)
  290. .then((response) => {
  291. //console.log(JSON.stringify(response));
  292. if(response.data.STATUSCODE == "404"){
  293. this.resendValid = false;
  294. if(response.data.MSG == "0"){
  295. this.dialog = true;
  296. }else if(response.data.MSG == "2"){
  297. this.deleteDialog = true;
  298. }else{
  299. this.wrongMessageActive = true;
  300. }
  301. }
  302. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  303. let data = response.data.DATA.rel
  304. if(data){
  305. this.result = data;
  306. this.disableBtn = false;
  307. this.resendValid = false;
  308. this.chackMailDialog = true;
  309. this.disableBtn = !this.disableBtn;
  310. this.timeout = setInterval(() => {
  311. if (this.countdown > 0) {
  312. this.countdown--;
  313. }
  314. if (this.countdown == 0) {
  315. this.resendValid = true;
  316. this.disableBtn = true;
  317. this.countdown = 60;
  318. clearInterval(this.timeout);
  319. }
  320. }, 1000);
  321. }
  322. }
  323. })
  324. .catch((error) => {
  325. console.log(error);
  326. });
  327. },
  328. resetUserPass() {
  329. if (
  330. this.userData.Password === this.userConfirmPass &&
  331. this.resetValid
  332. ) {
  333. //this.userData.user_id = this.$route.query.user_uuid;
  334. //this.userData.auth_code = this.$route.query.auth_code;
  335. this.$axios
  336. .post(`/trending/api/Signup/ResetPassword?Email=${this.getPath}&Password=${this.userData.Password}`)
  337. .then((response) => {
  338. //console.log(JSON.stringify(response));
  339. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  340. let data = response.data.DATA.rel
  341. if(data){
  342. this.resetSuccess = !this.resetSuccess;
  343. this.countdown = 3;
  344. this.timer = setInterval(() => {
  345. if (this.countdown > 0) {
  346. this.countdown--;
  347. } else {
  348. clearInterval(this.timer);
  349. this.$router.push(this.localePath("/"));
  350. }
  351. }, 1000);
  352. }
  353. }
  354. })
  355. .catch((error) => {
  356. console.log(error);
  357. });
  358. }
  359. },
  360. resendVerifyEmail() {
  361. this.countdown = 60;
  362. this.$axios
  363. .post(
  364. `/trending/api/Signup/ReSendVerifyMail?Email=${this.Email}`
  365. )
  366. .then((response) => {
  367. //console.log(JSON.stringify(response))
  368. if(response && response.data){
  369. this.dialog = false;
  370. this.resendValid = true;
  371. clearInterval(this.timer);
  372. this.timer = setInterval(() => {
  373. if (this.countdown > 0) {
  374. this.countdown--;
  375. }
  376. if (this.countdown === 0) {
  377. clearInterval(this.timer);
  378. }
  379. }, 1000);
  380. }
  381. })
  382. .catch((error) => {
  383. console.log(error);
  384. });
  385. },
  386. ReactivateAccount(){
  387. this.$axios
  388. .post(
  389. `/trending/api/Members/ReactivateAccount?Email=${this.Email}`
  390. )
  391. .then((response) => {
  392. //console.log(JSON.stringify(response))
  393. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  394. let data = response.data.DATA.rel
  395. if(data){
  396. this.deleteDialog = false;
  397. window.location.href = '/';
  398. }
  399. }
  400. })
  401. .catch((error) => {
  402. console.log(error);
  403. });
  404. },
  405. },
  406. beforeUnmount() {
  407. clearInterval(this.timeout);
  408. clearInterval(this.timer);
  409. },
  410. };
  411. </script>
  412. <style scoped>
  413. .title {
  414. font-weight: 700;
  415. font-size: 26px;
  416. line-height: 34px;
  417. letter-spacing: 0.02em;
  418. color: #232323;
  419. }
  420. </style>