@fishawack/lab-velocity 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <h1 class="h2">Sign in</h1>
3
+ <p class="mb-2">Enter your password to continue.</p>
4
+
5
+ <form @submit.prevent="submit" class="form" id="memberLoginForm">
6
+ <el-input
7
+ class="mb-2.5"
8
+ label="Email"
9
+ placeholder="Enter your email address"
10
+ name="email"
11
+ type="email"
12
+ required
13
+ v-model="form.email"
14
+ :error="form.errors"
15
+ />
16
+
17
+ <el-input
18
+ class="mb-2.5"
19
+ label="Password"
20
+ placeholder="Enter your password"
21
+ name="password"
22
+ type="password"
23
+ required
24
+ v-model="form.password"
25
+ :error="form.errors"
26
+ />
27
+
28
+ <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
29
+ <div style="position: absolute; left: -5000px" aria-hidden="true">
30
+ <input
31
+ ref="honeypot"
32
+ type="text"
33
+ name="b_0e1715593ad9366bc5d3ad8be_7aca058f12"
34
+ tabindex="-1"
35
+ value=""
36
+ />
37
+ </div>
38
+
39
+ <button
40
+ type="submit"
41
+ :disabled="loading || (form.email?.length < 5 || form.password?.length < 8 )"
42
+ class="button button--primary"
43
+ >
44
+ Continue
45
+ </button>
46
+
47
+ <p class="disclaimer mt-2">
48
+ Having trouble signing in?
49
+ <router-link class="color-1 underline" :to="{ name: `${$store.state.authBase}.forgot` }">
50
+ Reset password
51
+ </router-link>
52
+ or
53
+ <a :href="contact" class="underline">Contact us</a>
54
+ </p>
55
+ </form>
56
+ </template>
57
+
58
+ <script>
59
+ import Form from "form-backend-validation";
60
+ import { default as elInput} from "../../form/basic.vue";
61
+
62
+ export default {
63
+ components: {
64
+ elInput: elInput
65
+ },
66
+ data() {
67
+ return {
68
+ form: new Form(
69
+ {
70
+ email: this.$route.query.email ?? '',
71
+ password: '',
72
+ device_name: "Mobile device",
73
+ remember: true,
74
+ },
75
+ { resetOnSuccess: false }
76
+ ),
77
+ loading: false,
78
+ contact: process.env.HYDRATE_CONTACT ?? 'mailto:EP@avalerehealth.com',
79
+ };
80
+ },
81
+
82
+ methods: {
83
+ async submit() {
84
+ if (this.loading) return;
85
+
86
+ this.loading = true;
87
+
88
+ try {
89
+ const res = await this.form.post("/login");
90
+
91
+ if (res["logged-in"]) {
92
+ try {
93
+ await this.$store.dispatch("logout", {
94
+ errors: this.$root.errors,
95
+ });
96
+ } catch (e) {}
97
+
98
+ await this.form.post("/login");
99
+ }
100
+
101
+ await this.postLogin();
102
+ } catch (e) {
103
+ this.$root.errors(e);
104
+ } finally {
105
+ this.loading = false;
106
+ }
107
+ },
108
+
109
+ async postLogin() {
110
+ this.$store.commit("setAuth", true);
111
+
112
+ const { data: user } = await this.$store.dispatch("getUser", {
113
+ errors: this.$root.errors,
114
+ });
115
+
116
+ if (window.dataLayer) {
117
+ window.dataLayer.push({ event: "login", user });
118
+ }
119
+
120
+ if (this.$store.state.intended) {
121
+ this.$router.push(this.$store.state.intended);
122
+ } else {
123
+ this.$router.push({ name: "members" });
124
+ // Problem here
125
+ }
126
+
127
+ this.$store.commit("setIntended", null);
128
+ },
129
+ },
130
+
131
+ mounted() {
132
+ if (this.$route.query.authenticated) {
133
+ this.postLogin();
134
+ }
135
+ },
136
+ };
137
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <!-- Set Spinner -->
3
+ </template>
4
+
5
+ <script>
6
+
7
+ export default {
8
+ data() {
9
+ return {
10
+
11
+ }
12
+ },
13
+
14
+ methods: {
15
+ async postLogin() {
16
+ this.$store.commit("setAuth", true);
17
+
18
+ const { data: user } = await this.$store.dispatch("getUser", {
19
+ errors: this.$root.errors,
20
+ });
21
+
22
+ if (window.dataLayer) {
23
+ window.dataLayer.push({ event: "login", user });
24
+ }
25
+
26
+ if (this.$store.state.intended) {
27
+ this.$router.push(this.$store.state.intended);
28
+ } else {
29
+ this.$router.push({ name: "members" });
30
+ // Problem Here
31
+ }
32
+
33
+ this.$store.commit("setIntended", null);
34
+ },
35
+ },
36
+
37
+ mounted() {
38
+ if (this.$route.query.authenticated) {
39
+ this.postLogin();
40
+ }
41
+ },
42
+ };
43
+ </script>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <template v-if="stage === 1">
3
+ <h1 class="h2">Sign in</h1>
4
+ <p class="mb-2">Enter your email address to continue. </p>
5
+
6
+ <form @submit.prevent="submit" class="form" id="memberLoginForm">
7
+ <el-input
8
+ class="mb-2.5"
9
+ label="Email"
10
+ placeholder="Enter your email address"
11
+ name="email"
12
+ type="email"
13
+ required
14
+ v-model="form.email"
15
+ :error="form.errors"
16
+ />
17
+
18
+ <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
19
+ <div style="position: absolute; left: -5000px" aria-hidden="true">
20
+ <input
21
+ ref="honeypot"
22
+ type="text"
23
+ name="b_0e1715593ad9366bc5d3ad8be_7aca058f12"
24
+ tabindex="-1"
25
+ value=""
26
+ />
27
+ </div>
28
+
29
+ <button
30
+ type="submit"
31
+ :disabled="loading || (form.email?.length < 5 || form.password?.length < 8 )"
32
+ class="button button--primary"
33
+ >
34
+ Continue
35
+ </button>
36
+
37
+ <p class="disclaimer mt-2">
38
+ Having trouble signing in?
39
+ <a :href="contact" class="underline">Contact us</a>
40
+ </p>
41
+ </form>
42
+ </template>
43
+ <template v-else>
44
+ <h1 class="h2">Sign in with SSO</h1>
45
+ <p>Redirecting you to your organisation’s Single Sign-On (SSO) gateway. Please wait a moment.</p>
46
+ <p>Redirecting <span class="color-11">in {{ countdown }} seconds...</span></p>
47
+ </template>
48
+ </template>
49
+
50
+ <script>
51
+ import Form from "form-backend-validation";
52
+
53
+ import { default as elInput} from "../../form/basic.vue";
54
+
55
+ export default {
56
+ components: {
57
+ elInput: elInput,
58
+ },
59
+ data() {
60
+ return {
61
+ form: new Form(
62
+ {
63
+ email: '',
64
+ device_name: "Mobile device",
65
+ remember: true,
66
+ },
67
+ { resetOnSuccess: false }
68
+ ),
69
+ countdown: 3,
70
+ loading: false,
71
+ redirect_url: null,
72
+ stage: 1,
73
+ contact: process.env.HYDRATE_CONTACT ?? 'mailto:EP@avalerehealth.com',
74
+ };
75
+ },
76
+
77
+ methods: {
78
+ async submit() {
79
+ if (this.loading) return;
80
+
81
+ this.loading = true;
82
+
83
+ try {
84
+ const res = await this.form.post(`/sso`);
85
+ if(res['redirect_url']) {
86
+ this.redirect_url = res['redirect_url'];
87
+ this.setRedirect();
88
+ } else {
89
+ this.$router.push({name: `${this.$store.state.authBase}.logincreds`,query: {email: this.form.email}});
90
+ }
91
+ } catch (e) {
92
+ this.$root.errors(e);
93
+ } finally {
94
+ this.loading = false;
95
+ }
96
+ },
97
+ setRedirect(){
98
+ this.stage = 2;
99
+ let vue = this;
100
+ setTimeout(function() {
101
+ vue.setCountdown();
102
+ },1000);
103
+ },
104
+ setCountdown() {
105
+ this.countdown--;
106
+ if(this.countdown === 0) {
107
+ window.location = this.redirect_url;
108
+ } else {
109
+ let vue = this;
110
+ setTimeout(function() {
111
+ vue.setCountdown();
112
+ },1000);
113
+ }
114
+ }
115
+ },
116
+
117
+ mounted() {
118
+
119
+ },
120
+ };
121
+ </script>
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <h1 class="h2">Register</h1>
3
+ <p class="mb-2">Please enter your personal details to complete your registration.</p>
4
+
5
+ <form @submit.prevent="submit" :class="form.errors && form.errors.any() ? 'form error' : 'form'" id="memberLoginForm">
6
+ <el-input
7
+ class="mb-2.5"
8
+ label="Full name"
9
+ placeholder="Enter your full name"
10
+ name="name"
11
+ required
12
+ v-model="form.name"
13
+ :error="form.errors"
14
+ />
15
+
16
+ <el-input
17
+ class="mb-2.5"
18
+ label="Email"
19
+ placeholder="Enter your email address"
20
+ name="email"
21
+ type="email"
22
+ required
23
+ v-model="form.email"
24
+ :error="form.errors"
25
+ />
26
+
27
+ <el-input
28
+ class="mb-2.5"
29
+ label="Password"
30
+ name="password"
31
+ placeholder="Create a unique password"
32
+ autocomplete="new-password"
33
+ type="password"
34
+ required
35
+ v-model="form.password"
36
+ :error="form.errors"
37
+ />
38
+
39
+ <VPasswordValidation :password="form.password" @passwordValid="updatePasswordValidity" />
40
+
41
+ <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
42
+ <div style="position: absolute; left: -5000px" aria-hidden="true">
43
+ <input
44
+ ref="honeypot"
45
+ type="text"
46
+ name="b_0e1715593ad9366bc5d3ad8be_7aca058f12"
47
+ tabindex="-1"
48
+ value=""
49
+ />
50
+ </div>
51
+
52
+ <button
53
+ type="submit"
54
+ :disabled="loading || (form.name?.length < 1 || form.email?.length < 5 || !isPasswordValid)"
55
+ class="button button--primary"
56
+ >
57
+ Register
58
+ </button>
59
+
60
+ <p class="disclaimer mt-2">
61
+ Having trouble registering?
62
+ <a :href="contact" class="underline">Contact us</a>
63
+ </p>
64
+ </form>
65
+ </template>
66
+
67
+ <script>
68
+ import Form from "form-backend-validation";
69
+ import { default as elInput} from "../../form/basic.vue";
70
+
71
+ export default {
72
+ data() {
73
+ return {
74
+ form: new Form(
75
+ {
76
+ name: '',
77
+ email: '',
78
+ password: '',
79
+ },
80
+ { resetOnSuccess: false }
81
+ ),
82
+ loading: false,
83
+ isPasswordValid: false,
84
+ contact: process.env.HYDRATE_CONTACT ?? 'mailto:EP@avalerehealth.com',
85
+ };
86
+ },
87
+
88
+ methods: {
89
+ async submit() {
90
+ if (this.loading) return;
91
+
92
+ this.loading = true;
93
+
94
+ try {
95
+ const res = await this.form.post("/register");
96
+
97
+ if (res["logged-in"]) {
98
+ try {
99
+ await this.$store.dispatch("logout", {
100
+ errors: this.$root.errors,
101
+ });
102
+ } catch (e) {}
103
+
104
+ await this.form.post("/register");
105
+
106
+ }
107
+ console.log(res);
108
+ if(res['redirect']) {
109
+ // Redirect here
110
+ this.$router.push({ name: `${this.$store.state.authBase}.account-exists`, query: {company:res['company']} });
111
+ } else {
112
+ await this.postLogin();
113
+ }
114
+
115
+ } catch (e) {
116
+ this.$root.errors(e);
117
+ } finally {
118
+ this.loading = false;
119
+ }
120
+ },
121
+
122
+ async postLogin() {
123
+ this.$store.commit("setAuth", true);
124
+
125
+ const { data: user } = await this.$store.dispatch("getUser", {
126
+ errors: this.$root.errors,
127
+ });
128
+
129
+ if (window.dataLayer) {
130
+ window.dataLayer.push({ event: "login", user });
131
+ }
132
+
133
+ if (this.$store.state.intended) {
134
+ this.$router.push(this.$store.state.intended);
135
+ } else {
136
+ this.$router.push({ name: `${this.$store.state.authBase}.verify` });
137
+ // Problem Here
138
+ }
139
+
140
+ this.$store.commit("setIntended", null);
141
+ },
142
+ updatePasswordValidity(isValid) {
143
+ this.isPasswordValid = isValid;
144
+ },
145
+ },
146
+
147
+ components: {
148
+ VPasswordValidation: require("./../components/VPasswordValidation.vue").default,
149
+ elInput: elInput
150
+ },
151
+ };
152
+ </script>
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <div class="relative">
3
+ <section id="resetPasswordForm">
4
+ <h1 class="h2">Reset password</h1>
5
+ <form class="form" @submit.prevent="submit">
6
+ <div v-if="!form.successful">
7
+ <p class="mt mb-0 color-21">
8
+ <strong class="">Email: {{ form?.email }}</strong>
9
+ </p>
10
+ <p class="mt-0.5">
11
+ Please create a new password. Passwords you have used previously aren’t permitted.
12
+ </p>
13
+ <el-input
14
+ v-model="form.password"
15
+ class="mt-2"
16
+ label="New Password"
17
+ placeholder="Enter new password"
18
+ name="password"
19
+ :error="form.errors"
20
+ type="password"
21
+ autocomplete="new-password"
22
+ required
23
+ />
24
+
25
+ <VPasswordValidation :password="form.password" @passwordValid="updatePasswordValidity" />
26
+
27
+ <el-input
28
+ v-model="form.token"
29
+ name="token"
30
+ :error="form.errors"
31
+ type="hidden"
32
+ required
33
+ />
34
+
35
+ <button
36
+ type="submit"
37
+ :disabled="form.processing || !isPasswordValid"
38
+ :loading="form.processing"
39
+ class="button button--primary mt-1.5"
40
+ >
41
+ <span v-text="'Reset password'" />
42
+ </button>
43
+ </div>
44
+ <div v-else>
45
+ <h4 class="mt" v-text="`Success!`" />
46
+ <p v-text="`Your password has been reset.`" />
47
+ <p class="disclaimer mb-2.5">
48
+ <router-link
49
+ class="color-1 underline"
50
+ :to="{ name: `${$store.state.authBase}.login` }"
51
+ >
52
+ Back to Sign in
53
+ </router-link>
54
+ </p>
55
+ </div>
56
+ </form>
57
+ </section>
58
+ </div>
59
+ </template>
60
+
61
+ <script>
62
+ import Form from "form-backend-validation";
63
+ import { default as elInput} from "../../form/basic.vue";
64
+
65
+ export default {
66
+ components: {},
67
+ data() {
68
+ return {
69
+ form: new Form(
70
+ {
71
+ email: '',
72
+ password: '',
73
+ token: '',
74
+ },
75
+ { resetOnSuccess: false }
76
+ ),
77
+ isPasswordValid: false,
78
+ };
79
+ },
80
+
81
+ mounted() {
82
+ this.form.email = this.$route.query.email;
83
+ this.form.token = this.$route.query.token;
84
+ },
85
+
86
+ methods: {
87
+ async submit() {
88
+ try {
89
+ const res = await this.form.post("/reset-password");
90
+
91
+ this.$router.push({
92
+ name: `${this.$store.state.authBase}.success-reset`,
93
+ query: { email: this.form.email },
94
+ });
95
+ } catch (e) {
96
+ if (e.response && e.response.status === 422 && e.response.data.message === "This password reset token is invalid.") {
97
+ this.$router.push({
98
+ name: `${this.$store.state.authBase}.expired-reset`,
99
+ query: { email: this.form.email },
100
+ });
101
+ }
102
+ this.$root.errors(e);
103
+ }
104
+ },
105
+
106
+ updatePasswordValidity(isValid) {
107
+ this.isPasswordValid = isValid;
108
+ },
109
+ },
110
+
111
+ metaInfo() {
112
+ return {
113
+ title: "Reset Password",
114
+ };
115
+ },
116
+
117
+ components: {
118
+ VPasswordValidation: require("./../components/VPasswordValidation.vue").default,
119
+ elInput: elInput
120
+ },
121
+ };
122
+ </script>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div class="relative">
3
+ <section id="forgotPasswordForm">
4
+ <h1 class="h2">Reset password</h1>
5
+
6
+ <form class="form" @submit.prevent="submit">
7
+ <p class="mt mb-0 color-21">
8
+ <strong class="">Email: {{ form?.email }}</strong>
9
+ </p>
10
+ <p class="mt-0.5">
11
+ If this account exists we have sent an email containing instructions for resetting the password. <strong>Please check your inbox.</strong>
12
+ </p>
13
+ <p class="mt-0.5">
14
+ Haven’t received the email after 10 minutes?
15
+ </p>
16
+
17
+ <el-input
18
+ class="mt-2 mb-2.5 hidden"
19
+ v-model="form.email"
20
+ label="Email address"
21
+ name="email"
22
+ :error="form.errors"
23
+ type="email"
24
+ placeholder="Email"
25
+ required
26
+ />
27
+
28
+ <button
29
+ type="submit"
30
+ :disabled="form.processing"
31
+ :loading="form.processing"
32
+ class="button button--primary"
33
+ >
34
+ Re-send instructions
35
+ </button>
36
+
37
+ <p class="disclaimer mt-2">
38
+ <router-link
39
+ class="color-1 underline"
40
+ :to="{ name: `${$store.state.authBase}.login` }"
41
+ >
42
+ Back to Sign in
43
+ </router-link>
44
+ </p>
45
+ </form>
46
+ </section>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import Form from "form-backend-validation";
52
+ import { default as elInput} from "../../form/basic.vue";
53
+
54
+ export default {
55
+ components: {
56
+ elInput: elInput
57
+ },
58
+ data: () => ({
59
+ form: new Form(
60
+ {
61
+ email: "",
62
+ },
63
+ { resetOnSuccess: false }
64
+ ),
65
+ notification: null,
66
+ }),
67
+
68
+ methods: {
69
+ async submit() {
70
+ try {
71
+ if (this.notification) {
72
+ this.notification.close();
73
+ this.notification = null;
74
+ }
75
+
76
+ await this.form.post("/forgot-password");
77
+
78
+ this.$notify({
79
+ type: "success",
80
+ message: "Email has been re-sent",
81
+ duration: 10000,
82
+ class: 'el-notification--success el-notification--right-override'
83
+ });
84
+ } catch (e) {
85
+ if (e.response && e.response.status === 422) {
86
+ this.notification = this.$notify({
87
+ type: "warning",
88
+ message: 'Please allow 10 minutes before re-requesting',
89
+ duration: 0,
90
+ class: 'el-notification--warning el-notification--right-override'
91
+ });
92
+ }
93
+ else {
94
+ this.$root.errors(e);
95
+ }
96
+ }
97
+ },
98
+ },
99
+
100
+ mounted() {
101
+ this.form.email = this.$route.query.email;
102
+
103
+ // If a user has come here directly then send them off to the original forgot screen to enter an email
104
+ if (!this.form.email) {
105
+ this.$router.push({
106
+ name: `${this.$store.state.authBase}.forgot`,
107
+ });
108
+ }
109
+ },
110
+
111
+ metaInfo() {
112
+ return {
113
+ title: "Forgot Password | Success",
114
+ };
115
+ },
116
+ };
117
+ </script>