Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/login config #1182

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion public/app-config.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{}
{
"LOGIN_TEXT": "Sign in",
"LOGIN_ICON": "mdi-microsoft-windows",
"APPLICATION_NAME": "Delft-FEWS Web Operator Client",
"COMPANY_NAME": "Deltares"
}
4 changes: 4 additions & 0 deletions src/services/application-config/ApplicationConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ export type ApplicationConfig = {
VITE_AUTH_ID: string
VITE_REQUEST_HEADER_AUTHORIZATION: RequestHeaderAuthorization
VITE_FEWS_WEBSERVICES_URL: string
LOGIN_TEXT: string
LOGIN_ICON: string
APPLICATION_NAME: string
COMPANY_NAME: string
}
8 changes: 7 additions & 1 deletion src/views/auth/DeltaresLogin.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<template>
<v-btn @click="login" color="primary" variant="elevated">
<v-icon>mdi-microsoft-windows</v-icon>Sign in
<v-icon>{{ loginIcon }}</v-icon
>{{ loginText }}
</v-btn>
</template>

<script setup lang="ts">
import { useRoute } from 'vue-router'
import { authenticationManager } from '../../services/authentication/AuthenticationManager.js'

import { configManager } from '@/services/application-config'

const route = useRoute()

function login(): void {
const redirect = route.query.redirect ?? '/'
authenticationManager.userManager.signinRedirect({ state: redirect })
}

const loginText = configManager.get('LOGIN_TEXT') ?? 'Sign in'
const loginIcon = configManager.get('LOGIN_ICON') ?? 'mdi-microsoft-windows'
</script>
10 changes: 8 additions & 2 deletions src/views/auth/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
<v-app>
<v-main class="login-container">
<div>&nbsp;</div>
<h1 style="color: white">Delft-FEWS Web Operator Client</h1>
<h1 style="color: white">{{ appName }}</h1>
<div class="login-providers">
<deltares-login name="Deltares" />
<deltares-login :name="companyName" />
</div>
</v-main>
</v-app>
</template>

<script setup lang="ts">
import DeltaresLogin from './DeltaresLogin.vue'

import { configManager } from '@/services/application-config'

const appName =
configManager.get('APPLICATION_NAME') ?? 'Delft-FEWS Web Operator Client'
const companyName = configManager.get('COMPANY_NAME') ?? 'Deltares'
</script>

<style scoped>
Expand Down