Skip to content
Snippets Groups Projects
Commit 7fba814d authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Refactor/change to cope with user reg form

parent 4c76e4e8
No related branches found
No related tags found
No related merge requests found
......@@ -23,25 +23,18 @@
-->
<template>
<main id="app" role="main" class="container">
<div v-if="$root.sharedState.uuid">
<router-view/>
</div>
<div v-else>
<Welcome></Welcome>
</div>
<router-view></router-view>
</main>
</template>
<script>
import Welcome from '@/components/Welcome'
import CommonUtil from "@/components/CommonUtil";
export default {
name: 'App',
components : {
Welcome
},
},
methods: {
},
beforeMount(){
......
......@@ -27,7 +27,7 @@
<font-awesome-icon style="font-size: large; color: #3d8052; padding-left: 5px;" icon="fa-user" /> <span
v-text="userLoggedInName"></span>
<br />
<a class="vips-btn" v-on:click="handleLogout()">{{ $t("logout.button.label")}}</a>
<a class="btn btn-primary" v-on:click="handleLogout()">{{ $t("logout.button.label")}}</a>
</div>
<div v-else>
<form class="my-2 my-lg-0">
......@@ -47,6 +47,7 @@
v-on:keyup.enter="handleLogin()">
{{ $t("login.button.label")}}
</button>
<router-link to="/RegisterUserForm" class="btn btn-warning" onclick="$('.offcanvas-collapse').toggleClass('open')">{{ $t("registeruser.button.label") }}</router-link>
<div v-show="errMsg" class="alert alert-warning alert-dismissible fade show">
{{errMsg}}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
......@@ -236,7 +237,7 @@
this.$emit(CommonUtil.CONST_EVENT_LOGIN_USER_DETAIL, '');
$('.offcanvas-collapse').removeClass('open');
this.$router.push('/logout');
this.$router.push('/Logout');
},
/** Remove stored data on logout */
removeStoredData() {
......
<!--
Copyright (c) 2022 NIBIO <http://www.nibio.no/>.
This file is part of VIPSObservationApp.
VIPSObservationApp is free software: you can redistribute it and/or modify
it under the terms of the NIBIO Open Source License as published by
NIBIO, either version 1 of the License, or (at your option) any
later version.
VIPSObservationApp is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
NIBIO Open Source License for more details.
You should have received a copy of the NIBIO Open Source License
along with VIPSObservationApp. If not, see <http://www.nibio.no/licenses/>.
Author: Bhabesh Bhabani Mukhopadhyay
Author: Tor-Einar Skog <tor-einar.skog@nibio.no>
Dated : 19-Aug-2021
-->
<template>
<div>
<h1>{{$t("logout.header.text")}}</h1>
<div class="alert alert-warning" role="alert">
{{$t("logout.success.text")}}
</div>
</div>
</template>
\ No newline at end of file
......@@ -545,6 +545,12 @@
appDiv.style.paddingRight = "15px";
appDiv.style.paddingLeft = "15px";
},
beforeRouteEnter(to,from,next){
next(vm=>{
if(vm.$root.sharedState.uuid == ""){ next("/Welcome"); }
else { next(); }
})
}
}
</script>
......
......@@ -784,6 +784,12 @@
this.observationForStore.locationIsPrivate = this.observation.locationIsPrivate;
this.observationForStore.polygonService = this.observation.polygonService;
}
},
beforeRouteEnter(to,from,next){
next(vm=>{
if(vm.$root.sharedState.uuid == ""){ next("/Welcome"); }
else { next(); }
})
}
}
......
......@@ -136,6 +136,12 @@
// Making it globally available, so that e.g. the Sync component can update the list
// calling e.g. this.$root.sharedState.observationListComponent.getObservationsFromStore();
this.$root.sharedState.observationListComponent = this;
},
beforeRouteEnter(to,from,next){
next(vm=>{
if(vm.$root.sharedState.uuid == ""){ next("/Welcome"); }
else { next(); }
})
}
}
</script>
......
......@@ -173,6 +173,12 @@
// calling e.g. this.$root.sharedState.placesListComponent.fooBar();
this.$root.sharedState.placesListComponent = this;
},
beforeRouteEnter(to,from,next){
next(vm=>{
if(vm.$root.sharedState.uuid == ""){ next("/Welcome"); }
else { next(); }
})
}
}
</script>
......
<!--
Copyright (c) 2023 NIBIO <http://www.nibio.no/>.
This file is part of VIPSObservationApp.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Tor-Einar Skog <tor-einar.skog@nibio.no>
Created : 2023-04-18
-->
<template>
<div>
<h1>Register new user</h1>
</div>
</template>
<script>
import CommonUtil from '@/components/CommonUtil';
export default {
name: 'RegisterUserForm'
}
</script>
\ No newline at end of file
......@@ -71,6 +71,6 @@
"about.header": "About",
"about.version": "Version",
"about.text": "<p>The app is developed by <a href='#' onclick=\"cordova.InAppBrowser.open('https://nibio.no/en', '_system')\">NIBIO</a>'s <a href='#' onclick=\"cordova.InAppBrowser.open('https://www.vips-landbruk.no/', '_system')\">VIPS</a> team.</p><p>VIPS project leader: <a href='#' onclick=\"cordova.InAppBrowser.open('https://www.nibio.no/ansatte/berit-nordskog', '_system')\">Berit Nordskog</a></p><p>&copy; 2022 <a href='#' onclick=\"cordova.InAppBrowser.open('https://nibio.no/en', '_system')\">NIBIO</a></p>",
"registeruser.button.label": "Register new user",
"copy" : "Copy"
}
\ No newline at end of file
......@@ -71,6 +71,6 @@
"about.header": "Om appen",
"about.version": "Versjon",
"about.text": "<p>Appen er utviklet av <a href='#' onclick=\"cordova.InAppBrowser.open('https://nibio.no/', '_system')\">NIBIO</a>s <a href='#' onclick=\"cordova.InAppBrowser.open('https://www.vips-landbruk.no/', '_system')\">VIPS-team</a>.</p><p>Prosjektleder for VIPS: <a href='#' onclick=\"cordova.InAppBrowser.open('https://www.nibio.no/ansatte/berit-nordskog', '_system')\">Berit Nordskog</a></p><p>&copy; 2022 <a href='#' onclick=\"cordova.InAppBrowser.open('https://nibio.no/', '_system')\">NIBIO</a></p>",
"registeruser.button.label": "Registrer ny bruker",
"copy" : "Kopi"
}
\ No newline at end of file
......@@ -72,12 +72,11 @@ const init = () => {
},
i18n,
created() {
CommonUtil.setHeaderTitle(this.$i18n.t("index.header"));
CommonUtil.logInfo("Vue is ready");
CommonUtil.logInfo("User's preferred language is " + this.$i18n.locale);
// Are we logged in already?
CommonUtil.setHeaderTitle(this.$i18n.t("index.header"));
CommonUtil.logInfo("Vue is ready");
CommonUtil.logInfo("User's preferred language is " + this.$i18n.locale);
// Are we logged in already?
}
......
......@@ -9,11 +9,12 @@ import CropCategory from '@/components/CropCategory'
import MapObservation from '@/components/MapObservation'
import MapPOI from '@/components/MapPOI'
import Quantification from '@/components/Quantification'
import Logout from '@/components/Logout'
import RegisterUserForm from '@/components/RegisterUserForm'
Vue.use(Router)
export default new Router({
const router = new Router({
routes: [
{
path: '/welcome',
......@@ -61,11 +62,42 @@ export default new Router({
name : 'Quantification',
component : Quantification
},
{
path : '/RegisterUserForm',
name : 'RegisterUserForm',
component : RegisterUserForm
},
{
path : '/logout',
name : 'Logout',
component : Logout
component : Welcome
},
]
})
export default router;
/*router.beforeEach((to,from,next) => {
//console.info(this.sharedState);
//console.info(router.app.$root.sharedState);
//console.info(router.app.$root.sharedState.uuid);
//console.info(from);
//console.info("uuid=" + router.app.$root.sharedState.uuid);
console.info("to.name=" + to.name);
console.info(router.app.sharedState)
//var isLoggedIn = router.app.$root.sharedState.uuid != undefined && router.app.$root.sharedState.uuid != "";
if(!isLoggedIn && ["RegisterUserForm","Welcome"].indexOf(to.name) < 0)
{
next({name:"Welcome"});
}
else {
next();
}
});
*/
......@@ -23,6 +23,11 @@ a.nav-link{
border-color: #3d8052;
}
.btn-primary, .btn-primary:hover {
background-color: #3d8052;
border-color: #3d8052;
}
a.vips-btn {
background-color: #3d8052;
color: white;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment