-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branches 'next' and 'next' of github.com:devforth/adminforth in…
…to next
- Loading branch information
Showing
4 changed files
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
name="username" | ||
id="username" | ||
ref="usernameInput" | ||
oninput="setCustomValidity('')" | ||
@keydown.enter="passwordInput.focus()" | ||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white" placeholder="[email protected]" required /> | ||
</div> | ||
|
@@ -53,6 +54,7 @@ | |
<input | ||
ref="passwordInput" | ||
autocomplete="current-password" | ||
oninput="setCustomValidity('')" | ||
@keydown.enter="login" | ||
:type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white" required /> | ||
<button type="button" @click="showPw = !showPw" class="absolute top-12 right-3 -translate-y-1/2 text-gray-400 dark:text-gray-300"> | ||
|
@@ -120,6 +122,9 @@ import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbi | |
import { callAdminForthApi, loadFile } from '@/utils'; | ||
import { useRoute, useRouter } from 'vue-router'; | ||
import { Button, Checkbox } from '@/afcl'; | ||
import { useI18n } from 'vue-i18n'; | ||
const { t } = useI18n(); | ||
const passwordInput = ref(null); | ||
const usernameInput = ref(null); | ||
|
@@ -167,9 +172,15 @@ async function login() { | |
const username = usernameInput.value.value; | ||
const password = passwordInput.value.value; | ||
if (!username || !password) { | ||
if (!username) { | ||
usernameInput.value.setCustomValidity(t('Please fill out this field.')); | ||
return; | ||
} | ||
if (!password) { | ||
passwordInput.value.setCustomValidity(t('Please fill out this field.')); | ||
return; | ||
} | ||
if (inProgress.value) { | ||
return; | ||
} | ||
|
@@ -184,7 +195,7 @@ async function login() { | |
} | ||
}); | ||
if (resp.error) { | ||
error.value = resp.error; | ||
error.value = resp.error; | ||
} else if (resp.redirectTo) { | ||
router.push(resp.redirectTo); | ||
} else { | ||
|