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

Add func for user password reset

parent 216e8304
Branches
No related tags found
No related merge requests found
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
CONST_URL_AUTH_UUID: '/rest/auth/uuid', CONST_URL_AUTH_UUID: '/rest/auth/uuid',
CONST_URL_AUTH_LOGIN: '/rest/auth/login', CONST_URL_AUTH_LOGIN: '/rest/auth/login',
CONST_URL_LAST_TIMESTAMP: '/rest/observation/organismsystemupdated', CONST_URL_LAST_TIMESTAMP: '/rest/observation/organismsystemupdated',
CONST_URL_USER: '/user',
CONST_URL_CROP_CATEGORY: '/rest/organism/cropcategory/', CONST_URL_CROP_CATEGORY: '/rest/organism/cropcategory/',
CONST_URL_CROP_LIST: '/rest/organism/crop/list', CONST_URL_CROP_LIST: '/rest/organism/crop/list',
......
...@@ -93,7 +93,6 @@ ...@@ -93,7 +93,6 @@
}, },
autoLogout: function() { autoLogout: function() {
this.$root.$emit("autoLogout"); this.$root.$emit("autoLogout");
console.info("AutoLogout!")
} }
} }
} }
......
...@@ -43,12 +43,31 @@ ...@@ -43,12 +43,31 @@
:aria-label="$t('login.pwd.field.placeholder')" v-model="password" :aria-label="$t('login.pwd.field.placeholder')" v-model="password"
v-on:keyup.enter="handleLogin()" /> v-on:keyup.enter="handleLogin()" />
</div> </div>
<div class="form-group">
<button class="btn btn-primary" type="button" v-on:click="handleLogin()" <button class="btn btn-primary" type="button" v-on:click="handleLogin()"
v-on:keyup.enter="handleLogin()"> v-on:keyup.enter="handleLogin()">
{{ $t("login.button.label")}} {{ $t("login.button.label")}}
</button> </button>
<router-link to="/RegisterUserForm" class="btn btn-warning" onclick="$('.offcanvas-collapse').toggleClass('open')">{{ $t("registeruser.button.label") }}</router-link> <router-link to="/RegisterUserForm" class="btn btn-warning" onclick="$('.offcanvas-collapse').toggleClass('open')">{{ $t("registeruser.button.label") }}</router-link>
</div>
<div v-show="!showForgottenPasswordForm && !showForgottenPasswordSubmitSuccessMsg" class="form-group" v-on:click="showForgottenPasswordForm=true"><a href="#" class="card-link">{{ $t("login.forgotpassword.label") }}</a></div>
<div v-show="showForgottenPasswordForm" >
<h4>{{ $t("login.forgotpassword.label") }}</h4>
{{ $t("login.forgotpassword.description")}}
<div class="form-group">
<input type="text" class="form-control" v-model="email" :placeholder="$t('login.forgotpassword.field.placeholder')"/>
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" v-on:click="handleForgottenPassword()">
{{ $t("login.forgotpassword.button.label")}}
</button>
</div>
</div>
<div v-show="showForgottenPasswordSubmitSuccessMsg" class="form-group">
<h4>{{ $t("login.forgotpassword.label") }}</h4>
{{ $t("login.forgotpassword.success.msg")}}
</div>
<div v-show="errMsg" class="alert alert-warning alert-dismissible fade show"> <div v-show="errMsg" class="alert alert-warning alert-dismissible fade show">
{{errMsg}} {{errMsg}}
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" data-dismiss="alert" aria-label="Close">
...@@ -92,6 +111,9 @@ ...@@ -92,6 +111,9 @@
isSyncNeeded: false, isSyncNeeded: false,
errMsg: '', errMsg: '',
isLogginFail: false, isLogginFail: false,
email: "",
showForgottenPasswordForm: false,
showForgottenPasswordSubmitSuccessMsg: false
}; };
}, },
//emits: {}, //emits: {},
...@@ -249,6 +271,25 @@ ...@@ -249,6 +271,25 @@
$('.offcanvas-collapse').removeClass('open'); $('.offcanvas-collapse').removeClass('open');
this.$router.push('/Logout'); this.$router.push('/Logout');
}, },
handleForgottenPassword: async function(){
const formData = new URLSearchParams();
formData.append("email", this.email);
const response = await fetch(
CommonUtil.CONST_URL_DOMAIN + CommonUtil.CONST_URL_USER + "?action=resetPasswordRequestFormSubmit",
{
method: "POST",
body: formData
}
);
if(response.status != 200)
{
alert("Something went wrong. Status code = " + response.status + ". Please contact your system administrator");
return false;
}
this.showForgottenPasswordForm = false;
this.showForgottenPasswordSubmitSuccessMsg = true;
},
/** Remove stored data on logout */ /** Remove stored data on logout */
removeStoredData() { removeStoredData() {
/* Remove localstorage */ /* Remove localstorage */
......
...@@ -10,7 +10,12 @@ ...@@ -10,7 +10,12 @@
"login.pwd.field.placeholder": "Password", "login.pwd.field.placeholder": "Password",
"login.systems.wrong.credential": "Wrong username and/or password. Please try again.", "login.systems.wrong.credential": "Wrong username and/or password. Please try again.",
"logout.header.text": "Logout", "logout.header.text": "Logout",
"logout.success.text": "You successfully log out ", "logout.success.text": "You have successfully logged out ",
"login.forgotpassword.label": "Forgotten password",
"login.forgotpassword.description": "An email will be sent to the provided address, with instructions on how to reset your password.",
"login.forgotpassword.field.placeholder": "E-mail address",
"login.forgotpassword.button.label": "Send e-mail address",
"login.forgotpassword.success.msg": "Your request has been accepted. An e-mail with further instructions has been sent.",
"observation.date.label": "Observation Date", "observation.date.label": "Observation Date",
"observation.quantification.label": "Quantify", "observation.quantification.label": "Quantify",
"observation.quantification.form.label": "Observasjon quantification", "observation.quantification.form.label": "Observasjon quantification",
......
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
"login.systems.wrong.credential": "Feil brukernavn og/eller passord. Vennligst prøv igjen.", "login.systems.wrong.credential": "Feil brukernavn og/eller passord. Vennligst prøv igjen.",
"logout.header.text": "Logg ut", "logout.header.text": "Logg ut",
"logout.success.text": "Du er nå utlogget", "logout.success.text": "Du er nå utlogget",
"login.forgotpassword.label": "Glemt passord",
"login.forgotpassword.description": "En e-post sendes til den adressen du registrerer her med informasjon om hvordan du nullstiller nåværende passord og oppretter et nytt.",
"login.forgotpassword.field.placeholder": "E-postadresse",
"login.forgotpassword.button.label": "Send e-postadresse",
"login.forgotpassword.success.msg": "Din henvendelse er behandlet og akseptert. En e-post med flere instruksjoner har blitt sendt til den registrerte e-postadressen.",
"observation.date.label": "Observasjonsdato", "observation.date.label": "Observasjonsdato",
"observation.quantification.label": "Tell/kvantifiser", "observation.quantification.label": "Tell/kvantifiser",
"observation.quantification.form.label": "Observasjonsspesifikke detaljer", "observation.quantification.form.label": "Observasjonsspesifikke detaljer",
......
...@@ -63,13 +63,15 @@ div.addItem { ...@@ -63,13 +63,15 @@ div.addItem {
bottom: 25px; bottom: 25px;
right: 25px; right: 25px;
z-index: 1000; z-index: 1000;
} }
div.addItem button {
background-color: #3d8052 !important; div.addItem button {
border-radius: 25px; background-color: #3d8052 !important;
border: 0px; border-radius: 25px;
font-weight: bolder; border: 0px;
} font-weight: bolder;
}
#divAbout { #divAbout {
padding: 10px; padding: 10px;
border: 1px solid #3d8052; border: 1px solid #3d8052;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment