From d495411ef54e0efe5dab19b7a66fbfd9ed3f3687 Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Thu, 13 Jul 2023 02:05:02 +0530
Subject: [PATCH] feat: Minor improvements to login UI (#7494)
Co-authored-by: Pranav Raj S
---
.../dashboard/i18n/locale/en/login.json | 5 ++--
app/javascript/v3/views/login/Index.vue | 26 ++++++++++++-------
tailwind.config.js | 15 +++++++++++
3 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/app/javascript/dashboard/i18n/locale/en/login.json b/app/javascript/dashboard/i18n/locale/en/login.json
index f2b2f51b9..fb33028d6 100644
--- a/app/javascript/dashboard/i18n/locale/en/login.json
+++ b/app/javascript/dashboard/i18n/locale/en/login.json
@@ -3,7 +3,8 @@
"TITLE": "Login to Chatwoot",
"EMAIL": {
"LABEL": "Email",
- "PLACEHOLDER": "example@companyname.com"
+ "PLACEHOLDER": "example@companyname.com",
+ "ERROR": "Please enter a valid email address"
},
"PASSWORD": {
"LABEL": "Password",
@@ -20,7 +21,7 @@
"NO_ACCOUNT_FOUND": "We couldn't find an account for your email address."
},
"FORGOT_PASSWORD": "Forgot your password?",
- "CREATE_NEW_ACCOUNT": "Create new account",
+ "CREATE_NEW_ACCOUNT": "Create a new account",
"SUBMIT": "Login"
}
}
diff --git a/app/javascript/v3/views/login/Index.vue b/app/javascript/v3/views/login/Index.vue
index 29c442cf2..36b52123f 100644
--- a/app/javascript/v3/views/login/Index.vue
+++ b/app/javascript/v3/views/login/Index.vue
@@ -1,6 +1,6 @@
{{ $t('COMMON.OR') }}
-
+
{{ $t('LOGIN.CREATE_NEW_ACCOUNT') }}
@@ -67,11 +70,7 @@
@@ -126,6 +125,7 @@ export default {
loginApi: {
message: '',
showLoading: false,
+ hasErrored: false,
},
error: '',
};
@@ -173,7 +173,14 @@ export default {
bus.$emit('newToastMessage', this.loginApi.message);
},
submitLogin() {
+ if (this.$v.credentials.email.$invalid) {
+ this.showAlert(this.$t('LOGIN.EMAIL.ERROR'));
+ return;
+ }
+
+ this.loginApi.hasErrored = false;
this.loginApi.showLoading = true;
+
const credentials = {
email: this.email
? decodeURIComponent(this.email)
@@ -193,6 +200,7 @@ export default {
if (this.email) {
window.location = '/app/login';
}
+ this.loginApi.hasErrored = true;
this.showAlert(response?.message || this.$t('LOGIN.API.UNAUTH'));
});
},
diff --git a/tailwind.config.js b/tailwind.config.js
index 009c4840c..708207df5 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -97,6 +97,21 @@ module.exports = {
},
body: '#2f3b49',
},
+ keyframes: {
+ wiggle: {
+ '0%': { transform: 'translateX(0)' },
+ '15%': { transform: 'translateX(0.375rem)' },
+ '30%': { transform: 'translateX(-0.375rem)' },
+ '45%': { transform: 'translateX(0.375rem)' },
+ '60%': { transform: 'translateX(-0.375rem)' },
+ '75%': { transform: 'translateX(0.375rem)' },
+ '90%': { transform: 'translateX(-0.375rem)' },
+ '100%': { transform: 'translateX(0)' },
+ },
+ },
+ animation: {
+ wiggle: 'wiggle 0.5s ease-in-out',
+ },
},
plugins: [
// eslint-disable-next-line