fix: render different form on login page

This commit is contained in:
Marcell FÜLÖP 2023-02-20 11:02:58 +00:00
parent a1393ca3b8
commit 5c861df64c
2 changed files with 21 additions and 1 deletions

View File

@ -110,6 +110,7 @@
"login": {
"createAnAccount": "Create an account",
"loginInstead": "Already have an account",
"oidc": "Loin with OAuth",
"password": "Password",
"passwordConfirm": "Password Confirmation",
"passwordsDontMatch": "Passwords don't match",

View File

@ -1,5 +1,5 @@
<template>
<div id="login" :class="{ recaptcha: recaptcha }">
<div id="login" :class="{ recaptcha: recaptcha }" v-if="authMethodJSON">
<form @submit="submit">
<img :src="logoURL" alt="File Browser" />
<h1>{{ name }}</h1>
@ -41,11 +41,24 @@
</p>
</form>
</div>
<div id="login" v-else-if="authMethodOIDC">
<form @submit="submit">
<img :src="logoURL" alt="File Browser" />
<h1>{{ name }}</h1>
<div v-if="error !== ''" class="wrong">{{ error }}</div>
<input
class="button button--block"
type="submit"
:value="$t('login.oidc')"
/>
</form>
</div>
</template>
<script>
import * as auth from "@/utils/auth";
import {
authMethod,
name,
logoURL,
recaptcha,
@ -59,6 +72,8 @@ export default {
signup: () => signup,
name: () => name,
logoURL: () => logoURL,
authMethodJSON: () => authMethod === "json",
authMethodOIDC: () => authMethod === "oidc",
},
data: function () {
return {
@ -87,6 +102,10 @@ export default {
event.preventDefault();
event.stopPropagation();
if (authMethod === 'oidc') {
return document.location.reload();
}
let redirect = this.$route.query.redirect;
if (redirect === "" || redirect === undefined || redirect === null) {
redirect = "/files/";