Skip to content

Commit

Permalink
ui bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arietimmerman committed Dec 2, 2023
1 parent b512c22 commit 6aaa2c4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 72 deletions.
111 changes: 42 additions & 69 deletions frontend/src/login/components/modules/otpMail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,19 @@
<template v-if="lonely">
<form v-if="!done" v-on:submit.prevent="onSubmit">
<div class="form-group">
<label
for="username"
:style="{
display: customerstyle.label_display != 'show' ? 'none' : 'block',
}"
>{{ $t("login.username") }}</label
>
<input
type="text"
class="form-control"
id="username"
:placeholder="$t('login.usernamePlaceholder')"
v-model="username"
/>
<label for="username" :style="{
display: customerstyle.label_display != 'show' ? 'none' : 'block',
}">{{ $t("login.username") }}</label>
<input type="text" class="form-control" id="username" :placeholder="$t('login.usernamePlaceholder')"
v-model="username" />
</div>

<div v-if="error" class="alert alert-danger" role="alert">
{{ error }}
</div>

<button
:style="{ backgroundColor: customerstyle['button_backgroundColor'] }"
class="btn btn-primary btn-block"
:class="{ 'btn-loading': isLoading }"
type="submit"
>
<button :style="{ backgroundColor: customerstyle['button_backgroundColor'] }" class="btn btn-primary btn-block"
:class="{ 'btn-loading': isLoading }" type="submit">
<span>{{ $t("login.otpEmailButton") }}</span>
</button>
</form>
Expand All @@ -37,38 +24,24 @@
<p>{{ $t("login.otpEmailSuccess") }}</p>

<div class="form-group">
<label
for="otp"
:style="{
display: customerstyle.label_display != 'show' ? 'none' : 'block',
}"
>{{ $t("login.otp") }}</label
>
<label for="otp" :style="{
display: customerstyle.label_display != 'show' ? 'none' : 'block',
}">{{ $t("login.otp") }}</label>
<input type="text" class="form-control" id="otp" v-model="otp" />
</div>

<div v-if="error" class="alert alert-danger" role="alert">
{{ error }}
</div>

<button
:style="{ backgroundColor: customerstyle['button_backgroundColor'] }"
class="btn btn-primary btn-block"
:class="{ 'btn-loading': isLoading }"
type="submit"
>
<button :style="{ backgroundColor: customerstyle['button_backgroundColor'] }" class="btn btn-primary btn-block"
:class="{ 'btn-loading': isLoading }" type="submit">
<span>{{ $t("login.otpEmailButtonFinish") }}</span>
</button>
</form>
</template>

<a
v-else
class="nav-link text-center"
href="#"
@click.prevent="activate(props.module)"
active-class="active"
>
<a v-else class="nav-link text-center" href="#" @click.prevent="activate(props.module)" active-class="active">
{{ $t("login.otpEmailLink") }}
</a>
</div>
Expand All @@ -77,8 +50,8 @@
<script setup>
import { useStateStore } from '../store';
import {defineProps, ref} from 'vue';
import {request, baseProps, activate} from './composable';
import { defineProps, ref } from 'vue';
import { request, baseProps, activate } from './composable';
const state = useStateStore();
const username = ref(null);
const otp = ref(null);
Expand All @@ -91,18 +64,18 @@ const props = defineProps(baseProps);
function onSubmitOtp() {
request(
props.module,props.authRequest,
{
otp: otp,
user_id_hashed: user_id,
}).then(
(_response) => {
},
(error) => {
state.error(error.data.error);
}
);
props.module, props.authRequest,
{
otp: otp.value,
user_id_hashed: user_id.value,
}).then(
(_response) => {
},
(error) => {
state.error(error.data.error);
}
);
}
function onSubmit() {
Expand All @@ -113,20 +86,20 @@ function onSubmit() {
isLoading.value = true;
request(
props.module, props.authRequest,
{
username: username.value,
remember: remember.value,
}).then(
(response) => {
done.value = true;
user_id.value = response.data.user_id_hashed;
isLoading.value = false;
},
(error) => {
loading.value = false;
state.error(error.data.error);
}
);
props.module, props.authRequest,
{
username: username.value,
remember: remember.value,
}).then(
(response) => {
done.value = true;
user_id.value = response.data.user_id_hashed;
isLoading.value = false;
},
(error) => {
loading.value = false;
state.error(error.data.error);
}
);
}
</script>
6 changes: 3 additions & 3 deletions frontend/src/login/components/modules/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ function onSubmit() {
overview();
});
},
(response) => {
console.log(response);
(error) => {
console.log(error.response);
isLoading.value = false;
errors.value = response.body.errors;
errors.value = error.response.data.detail;
}
);
}
Expand Down

0 comments on commit 6aaa2c4

Please sign in to comment.