mirror of
https://github.com/h44z/wg-portal.git
synced 2026-11-20 20:53:40 +01:00
feat(auth): require changing default admin password (#778)
This commit is contained in:
@@ -42,11 +42,20 @@ const login = async function () {
|
||||
const dest = returnUrl.value && returnUrl.value !== '/login' ? returnUrl.value : (auth.ReturnUrl || '/')
|
||||
auth.Login(username.value, password.value)
|
||||
.then(uid => {
|
||||
notify({
|
||||
title: "Logged in",
|
||||
text: "Authentication succeeded!",
|
||||
type: 'success',
|
||||
});
|
||||
if (auth.DefaultPasswordInUse) {
|
||||
notify({
|
||||
title: "Default Password in Use!",
|
||||
text: "Please change the default administrator password immediately. Unless the password gets changed, no further actions are possible.",
|
||||
type: 'warn',
|
||||
duration: 10000,
|
||||
});
|
||||
} else {
|
||||
notify({
|
||||
title: "Logged in",
|
||||
text: "Authentication succeeded!",
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
loggingIn.value = false;
|
||||
settings.LoadSettings(); // reload full settings
|
||||
auth.ResetReturnUrl();
|
||||
@@ -71,11 +80,20 @@ const loginWebAuthn = async function () {
|
||||
const dest = returnUrl.value && returnUrl.value !== '/login' ? returnUrl.value : (auth.ReturnUrl || '/')
|
||||
auth.LoginWebAuthn()
|
||||
.then(uid => {
|
||||
notify({
|
||||
title: "Logged in",
|
||||
text: "Authentication succeeded!",
|
||||
type: 'success',
|
||||
});
|
||||
if (auth.DefaultPasswordInUse) {
|
||||
notify({
|
||||
title: "Default Password in Use!",
|
||||
text: "Please change the default administrator password immediately. Unless the password gets changed, no further actions are possible.",
|
||||
type: 'warn',
|
||||
duration: 10000,
|
||||
});
|
||||
} else {
|
||||
notify({
|
||||
title: "Logged in",
|
||||
text: "Authentication succeeded!",
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
loggingIn.value = false;
|
||||
settings.LoadSettings(); // reload full settings
|
||||
auth.ResetReturnUrl();
|
||||
|
||||
@@ -57,6 +57,7 @@ const passwordChangeAllowed = computed(() => {
|
||||
const updatePassword = async () => {
|
||||
try {
|
||||
await profile.changePassword(pwFormData.value);
|
||||
auth.SetDefaultPasswordInUse(false);
|
||||
|
||||
pwFormData.value.OldPassword = '';
|
||||
pwFormData.value.Password = '';
|
||||
@@ -85,7 +86,7 @@ const updatePassword = async () => {
|
||||
|
||||
<p class="lead">{{ $t('settings.abstract') }}</p>
|
||||
|
||||
<div class="card border-secondary p-5 mt-5" v-if="profile.user.Source === 'db'">
|
||||
<div class="card border-secondary p-5 mt-5" v-if="profile.user.AuthSources?.includes('db')">
|
||||
<h2 class="display-7">{{ $t('settings.password.headline') }}</h2>
|
||||
<p class="lead">{{ $t('settings.password.abstract') }}</p>
|
||||
<hr class="my-4">
|
||||
|
||||
Reference in New Issue
Block a user