Skip to content

Commit 289f668

Browse files
committed
feat(ui): email auth
1 parent e8a1795 commit 289f668

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-8
lines changed

web/src/components/UserForm.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@
111111
:label="$t('adminUser')"
112112
></v-checkbox>
113113
</v-col>
114+
<v-col cols="6">
115+
<v-checkbox
116+
:disabled="!isAdmin"
117+
dense
118+
hide-details
119+
v-model="item.pro"
120+
:label="$t('Pro user')"
121+
></v-checkbox>
122+
</v-col>
114123
<v-col cols="6" v-if="isAdmin">
115124
<v-checkbox
116125
:disabled="!isNew"

web/src/lang/en.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export default {
7272
deleteEnvironment: 'Delete variable group',
7373
newEnvironment: 'New Group',
7474
environmentName: 'Group Name',
75+
dockerImage: 'Runner Docker Image (optional)',
7576
extraVariables: 'Extra variables',
7677
enterExtraVariablesJson: 'Enter extra variables JSON...',
7778
environmentVariables: 'Environment variables',
@@ -194,7 +195,7 @@ export default {
194195
cronChecksNewCommitBeforeRun: 'Cron checks new commit before run',
195196
readThe: 'Read the',
196197
toLearnMoreAboutCron: 'to learn more about Cron.',
197-
suppressSuccessAlerts: 'Suppress success alerts',
198+
suppressSuccessAlerts: 'Suppress success notifications',
198199
cliArgsJsonArrayExampleIMyinventoryshPrivatekeythe2: 'CLI Args (JSON array). Example: [ "-i", "@myinventory.sh", "--private-key=/there/id_rsa", "-vvvv" ]',
199200
allowCliArgsInTask: 'CLI args',
200201
docs: 'docs',

web/src/views/Auth.vue

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,16 @@
110110
</v-alert>
111111

112112
<div v-if="screen === 'verification'">
113-
<div class="text-center mb-4">
113+
114+
<div v-if="verificationMethod === 'totp'" class="text-center mb-4">
114115
Open the two-step verification app on your mobile device to
115116
get your verification code.
116117
</div>
117118

119+
<div v-else-if="verificationMethod === 'email'" class="text-center mb-4">
120+
Check your email for the verification code we just sent you.
121+
</div>
122+
118123
<v-otp-input
119124
v-model="verificationCode"
120125
length="6"
@@ -126,11 +131,20 @@
126131
<div class="text-center">
127132
<a @click="signOut()" class="mr-6">{{ $t('Return to login') }}</a>
128133
<a
129-
v-if="authMethods.totp && authMethods.totp.allow_recovery"
134+
v-if="verificationMethod === 'totp'
135+
&& authMethods.totp
136+
&& authMethods.totp.allow_recovery"
130137
@click="screen = 'recovery'"
131138
>
132139
{{ $t('Use recovery code') }}
133140
</a>
141+
142+
<a
143+
v-if="verificationMethod === 'email'"
144+
@click="resendEmailVerification()"
145+
>
146+
{{ $t('Resend code to email') }}
147+
</a>
134148
</div>
135149
</div>
136150

@@ -265,6 +279,11 @@
265279
height: 100vh;
266280
background: #80808024;
267281
}
282+
.auth {
283+
background-image: url("../assets/background.svg");
284+
background-color: #005057;
285+
background-size: cover;
286+
}
268287
</style>
269288
<script>
270289
import axios from 'axios';
@@ -316,6 +335,10 @@ export default {
316335
},
317336
318337
methods: {
338+
async resendEmailVerification() {
339+
// TODO: resend email verification code
340+
},
341+
319342
async loadLoginData() {
320343
await axios({
321344
method: 'get',
@@ -393,6 +416,11 @@ export default {
393416
status: 'unverified',
394417
verificationMethod: 'totp',
395418
};
419+
case 'EMAIL_OTP_REQUIRED':
420+
return {
421+
status: 'unverified',
422+
verificationMethod: 'email',
423+
};
396424
default:
397425
return { status: 'unauthenticated' };
398426
}
@@ -422,11 +450,12 @@ export default {
422450
});
423451
document.location = document.baseURI + window.location.search;
424452
} catch (err) {
425-
if (err.response.status === 401) {
426-
this.signInError = this.$t('Incorrect verification code.');
427-
} else {
428-
this.signInError = getErrorMessage(err);
429-
}
453+
this.signInError = getErrorMessage(err);
454+
// if (err.response.status === 401) {
455+
// this.signInError = this.$t('Incorrect verification code.');
456+
// } else {
457+
// this.signInError = getErrorMessage(err);
458+
// }
430459
} finally {
431460
this.signInProcess = false;
432461
}

0 commit comments

Comments
 (0)