2019-01-31 12:38:48 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2019-04-11 02:27:55 +01:00
|
|
|
<template src="./registrationSuccessPopup.html"></template>
|
2019-01-31 12:38:48 +00:00
|
|
|
|
|
|
|
<script lang="ts">
|
2019-09-09 11:33:39 +01:00
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
import VButton from '@/components/common/VButton.vue';
|
2019-09-09 11:33:39 +01:00
|
|
|
|
2019-10-23 13:26:39 +01:00
|
|
|
import CloseCrossIcon from '@/../static/images/common/closeCross.svg';
|
|
|
|
import RegistrationSuccessIcon from '@/../static/images/register/registerSuccess.svg';
|
|
|
|
|
2019-10-29 14:24:16 +00:00
|
|
|
import { AuthHttpApi } from '@/api/auth';
|
2019-09-09 11:33:39 +01:00
|
|
|
import { RouteConfig } from '@/router';
|
2019-10-28 17:33:06 +00:00
|
|
|
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
2019-11-12 12:14:05 +00:00
|
|
|
import { LocalData } from '@/utils/localData';
|
2019-09-09 11:33:39 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: {
|
2019-09-26 14:36:12 +01:00
|
|
|
VButton,
|
2019-10-23 13:26:39 +01:00
|
|
|
RegistrationSuccessIcon,
|
|
|
|
CloseCrossIcon,
|
2019-09-09 11:33:39 +01:00
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class RegistrationSuccessPopup extends Vue {
|
|
|
|
private isResendEmailButtonDisabled: boolean = true;
|
|
|
|
private timeToEnableResendEmailButton: string = '00:30';
|
|
|
|
private intervalID: any = null;
|
|
|
|
|
2019-10-29 14:24:16 +00:00
|
|
|
private readonly auth: AuthHttpApi = new AuthHttpApi();
|
2019-09-09 11:33:39 +01:00
|
|
|
|
|
|
|
public beforeDestroy(): void {
|
|
|
|
if (this.intervalID) {
|
|
|
|
clearInterval(this.intervalID);
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
2019-05-15 09:28:36 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public async onResendEmailButtonClick(): Promise<void> {
|
|
|
|
this.isResendEmailButtonDisabled = true;
|
2019-08-14 19:11:18 +01:00
|
|
|
|
2019-11-12 12:14:05 +00:00
|
|
|
const userId = LocalData.getUserId();
|
2019-09-09 11:33:39 +01:00
|
|
|
if (!userId) {
|
|
|
|
return;
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
try {
|
|
|
|
await this.auth.resendEmail(userId);
|
|
|
|
} catch (error) {
|
2019-10-28 17:33:06 +00:00
|
|
|
await this.$notify.error('Could not send email ');
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
this.startResendEmailCountdown();
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public onCloseClick(): void {
|
|
|
|
this.$store.dispatch(APP_STATE_ACTIONS.CLOSE_POPUPS);
|
|
|
|
this.$router.push(RouteConfig.Login.path);
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public get isPopupShown(): boolean {
|
|
|
|
return this.$store.state.appStateModule.appState.isSuccessfulRegistrationPopupShown;
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
private startResendEmailCountdown(): void {
|
|
|
|
let countdown = 30;
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
this.intervalID = setInterval(() => {
|
|
|
|
countdown--;
|
|
|
|
|
|
|
|
const secondsLeft = countdown > 9 ? countdown : `0${countdown}`;
|
|
|
|
this.timeToEnableResendEmailButton = `00:${secondsLeft}`;
|
|
|
|
|
|
|
|
if (countdown <= 0) {
|
|
|
|
clearInterval(this.intervalID);
|
|
|
|
this.isResendEmailButtonDisabled = false;
|
|
|
|
}
|
|
|
|
}, 1000);
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
2019-01-31 12:38:48 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.register-success-popup-container {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
background-color: rgba(134, 134, 148, 0.4);
|
|
|
|
z-index: 1000;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2019-05-15 09:28:36 +01:00
|
|
|
|
2019-01-31 12:38:48 +00:00
|
|
|
.register-success-popup {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 845px;
|
2019-10-28 15:59:19 +00:00
|
|
|
background-color: #fff;
|
2019-01-31 12:38:48 +00:00
|
|
|
border-radius: 6px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
align-items: flex-start;
|
|
|
|
position: relative;
|
|
|
|
justify-content: center;
|
|
|
|
padding: 80px 100px 80px 50px;
|
|
|
|
|
|
|
|
&__info-panel-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
|
|
|
margin-right: 100px;
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__form-container {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 440px;
|
|
|
|
margin-top: 10px;
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&__title {
|
2019-10-28 15:59:19 +00:00
|
|
|
font-family: 'font_bold', sans-serif;
|
2019-01-31 12:38:48 +00:00
|
|
|
font-size: 32px;
|
|
|
|
line-height: 39px;
|
2019-10-28 15:59:19 +00:00
|
|
|
color: #384b65;
|
2019-02-07 14:13:12 +00:00
|
|
|
margin: 0;
|
2019-11-01 16:00:28 +00:00
|
|
|
user-select: none;
|
2019-01-31 12:38:48 +00:00
|
|
|
}
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&__text {
|
2019-10-28 15:59:19 +00:00
|
|
|
font-family: 'font_medium', sans-serif;
|
2019-09-26 14:36:12 +01:00
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
color: #354049;
|
|
|
|
padding: 27px 0 0 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__verification-cooldown {
|
2019-10-28 15:59:19 +00:00
|
|
|
font-family: 'font_medium', sans-serif;
|
2019-09-26 14:36:12 +01:00
|
|
|
font-size: 12px;
|
|
|
|
line-height: 16px;
|
|
|
|
color: #354049;
|
|
|
|
padding: 27px 0 0 0;
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
&__bold-text {
|
2019-10-28 15:59:19 +00:00
|
|
|
color: #2683ff;
|
2019-09-26 14:36:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-31 12:38:48 +00:00
|
|
|
&__button-container {
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
2019-02-07 14:13:12 +00:00
|
|
|
margin-top: 15px;
|
2019-01-31 12:38:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&__close-cross-container {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
position: absolute;
|
|
|
|
right: 30px;
|
|
|
|
top: 40px;
|
|
|
|
height: 24px;
|
|
|
|
width: 24px;
|
|
|
|
cursor: pointer;
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&:hover .close-cross-svg-path {
|
2019-10-28 15:59:19 +00:00
|
|
|
fill: #2683ff;
|
2019-01-31 12:38:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media screen and (max-width: 720px) {
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2019-01-31 12:38:48 +00:00
|
|
|
.register-success-popup {
|
|
|
|
|
|
|
|
&__info-panel-container {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__form-container {
|
|
|
|
|
|
|
|
&__button-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|