2012-06-30 07:26:21 +02:00
|
|
|
<%@page pageEncoding="UTF-8" %>
|
|
|
|
<%@include file="/jsp/init.jsp" %>
|
2012-06-20 18:28:45 +02:00
|
|
|
|
|
|
|
<div>
|
|
|
|
<ul class="nav nav-tabs">
|
2013-03-17 22:51:33 +01:00
|
|
|
<c:if test="${principal.databaseSchema}">
|
|
|
|
<li class="active"><a href="#changeUserPanel" data-toggle="pill"><spring:message code="GENERAL"/></a></li>
|
|
|
|
<li><a href="#changePasswordPanel" data-toggle="pill"><spring:message code="SECURITY"/></a></li>
|
|
|
|
</c:if>
|
2012-07-01 22:56:31 +02:00
|
|
|
<li><a href="#languagePanel" data-toggle="pill"><spring:message code="LANGUAGE"/></a></li>
|
2014-02-12 03:27:46 +01:00
|
|
|
<c:if test="${principal.databaseSchema}">
|
|
|
|
<li><a href="#deleteAccountPanel" data-toggle="pill"><spring:message code="DELETE__ACCOUNT"/></a></li>
|
|
|
|
</c:if>
|
2012-06-20 18:28:45 +02:00
|
|
|
</ul>
|
|
|
|
|
2014-02-09 06:19:59 +01:00
|
|
|
<div class="tab-content" style="padding-top:15px;">
|
2013-03-17 22:51:33 +01:00
|
|
|
<div class="tab-pane fade ${principal.databaseSchema?'active in':''}" id="changeUserPanel">
|
2014-02-12 03:27:46 +01:00
|
|
|
<div id="changeInfoMsg" class="alert"></div>
|
2014-02-09 06:19:59 +01:00
|
|
|
<form action="#" method="POST" id="changeUserForm" class="form-horizontal">
|
2012-06-20 18:28:45 +02:00
|
|
|
<fieldset>
|
2014-02-09 06:19:59 +01:00
|
|
|
<div class="form-group">
|
2014-02-12 03:27:46 +01:00
|
|
|
<label for="email" class="col-md-3 control-label"><strong><spring:message
|
|
|
|
code="EMAIL"/>:</strong></label>
|
|
|
|
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-8">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="text" name="password" id="email" required="required" class="form-control"
|
|
|
|
readonly="readonly" value="${user.email}"/>
|
2014-02-09 06:19:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2014-02-10 00:12:24 +01:00
|
|
|
<label for="firstname" class="col-md-3 control-label"><strong><spring:message code="FIRSTNAME"/>:</strong></label>
|
2014-02-12 03:27:46 +01:00
|
|
|
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-8">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="text" name="firstname" id="firstname" required="required" class="form-control"
|
|
|
|
value="${user.firstname}"/>
|
|
|
|
</div>
|
2014-02-09 06:19:59 +01:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2014-02-12 03:27:46 +01:00
|
|
|
<label for="lastname" class="col-md-3 control-label"><strong><spring:message
|
|
|
|
code="LASTNAME"/>:</strong></label>
|
|
|
|
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-8">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="text" name="lastname" id="lastname" required="required" class="form-control"
|
|
|
|
value="${user.lastname}"/>
|
2014-02-09 06:19:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2014-02-09 08:54:36 +01:00
|
|
|
<div class="form-group">
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-offset-8 col-md-2">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="submit" id="changeUserInfoBtn" class="btn btn-primary" class="form-control"
|
|
|
|
value="<spring:message code="SAVE_CHANGES"/>"/>
|
|
|
|
</div>
|
2014-02-09 08:54:36 +01:00
|
|
|
</div>
|
2012-06-20 18:28:45 +02:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div class="tab-pane fade" id="changePasswordPanel">
|
|
|
|
<div id="changePasswordMsg" class="alert">
|
|
|
|
</div>
|
2014-02-12 03:27:46 +01:00
|
|
|
<form action="#" method="POST" id="changePasswordForm" class="form-horizontal">
|
2012-06-20 18:28:45 +02:00
|
|
|
<fieldset>
|
2014-02-09 06:19:59 +01:00
|
|
|
<div class="form-group">
|
2014-02-12 03:27:46 +01:00
|
|
|
<label for="password" class="col-md-3 control-label"><strong><spring:message
|
|
|
|
code="NEW_PASSWORD"/>:</strong></label>
|
|
|
|
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-8">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="password" name="password" id="password" required="required"
|
|
|
|
class="form-control"/>
|
2014-02-09 06:19:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2014-02-12 03:27:46 +01:00
|
|
|
<label for="repassword" class="col-md-3 control-label"><strong><spring:message
|
|
|
|
code="CONFIRM_NEW_PASSWORD"/>:</strong></label>
|
|
|
|
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-8">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="password" name="password" id="repassword" required="required"
|
|
|
|
class="form-control"/>
|
2014-02-09 06:19:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2014-02-09 08:54:36 +01:00
|
|
|
<div class="form-group">
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-offset-8 col-md-2">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="submit" id="changePasswordBtn" class="btn btn-primary"
|
|
|
|
value="<spring:message code="CHANGE_PASSWORD"/>"/>
|
2014-02-09 08:54:36 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2012-06-20 18:28:45 +02:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</div>
|
2013-03-17 22:51:33 +01:00
|
|
|
<div class="tab-pane fade ${principal.databaseSchema?'':'active in'}" id="languagePanel">
|
2012-06-30 07:26:21 +02:00
|
|
|
<div id="languageMsg" class="alert">
|
|
|
|
</div>
|
2014-02-09 06:19:59 +01:00
|
|
|
<form action="#" method="POST" id="languageForm" class="form-horizontal">
|
|
|
|
<div class="form-group">
|
2014-02-12 03:27:46 +01:00
|
|
|
<label for="language" class="col-md-3 control-label"><strong><spring:message
|
|
|
|
code="LANGUAGE"/>:</strong></label>
|
2014-02-10 00:12:24 +01:00
|
|
|
<div class="col-md-8">
|
2014-02-12 03:27:46 +01:00
|
|
|
<select name="language" id="language" class="form-control">
|
|
|
|
<option value="en">English</option>
|
|
|
|
<option value="es" <c:if test="${user.locale=='es'}">selected="selected" </c:if>>Spanish -
|
|
|
|
español
|
|
|
|
</option>
|
|
|
|
<option value="fr" <c:if test="${user.locale=='fr'}">selected="selected" </c:if>>French -
|
|
|
|
français
|
|
|
|
</option>
|
|
|
|
<option value="de" <c:if test="${user.locale=='de'}">selected="selected" </c:if>>German -
|
|
|
|
Deutsch
|
|
|
|
</option>
|
|
|
|
<option value="it" <c:if test="${user.locale=='it'}">selected="selected" </c:if>>Italian -
|
|
|
|
italiano
|
|
|
|
</option>
|
|
|
|
<option value="pt_BR" <c:if test="${user.locale=='pt_BR'}">selected="selected" </c:if>>
|
|
|
|
Portuguese
|
|
|
|
(Brazil) - português (Brasil)
|
|
|
|
</option>
|
|
|
|
<option value="zh_CN" <c:if test="${user.locale=='zh_CN'}">selected="selected" </c:if>>
|
|
|
|
Chinese
|
|
|
|
(Simplified Han) - 中文(简体中文)
|
|
|
|
</option>
|
|
|
|
<option value="zh_TW" <c:if test="${user.locale=='zh_TW'}">selected="selected" </c:if>>
|
|
|
|
Chinese
|
|
|
|
(Traditional Han) - 中文 (繁體中文)
|
|
|
|
</option>
|
|
|
|
<option value="ca" <c:if test="${user.locale=='ca'}">selected="selected" </c:if>>Catalan -
|
|
|
|
català
|
|
|
|
</option>
|
|
|
|
</select></div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-md-offset-8 col-md-2">
|
|
|
|
<input type="submit" id="changeLanguageBtn" class="btn btn-primary"
|
|
|
|
value="<spring:message code="CHANGE_LANGUAGE"/>"/>
|
2014-02-09 08:54:36 +01:00
|
|
|
</div>
|
2014-02-12 03:27:46 +01:00
|
|
|
</div>
|
2012-06-30 07:26:21 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
2014-01-10 02:38:59 +01:00
|
|
|
<div class="tab-pane fade" id="deleteAccountPanel">
|
2014-02-12 03:27:46 +01:00
|
|
|
<div id="deleteAccountMsg" class="alert alert-danger" style="display: block;"><spring:message
|
|
|
|
code="WARNING_DELETE_USER"/></div>
|
2014-01-10 02:38:59 +01:00
|
|
|
<form action="#" method="POST" id="deleteAccountForm">
|
2014-02-09 08:54:36 +01:00
|
|
|
<div class="form-group" style="text-align:right">
|
2014-02-12 03:27:46 +01:00
|
|
|
<input type="checkbox" name="confirmAccountDelete" id="accountMarkedForDelete" required="required"/>
|
|
|
|
<input type="submit" id="deleteAccountBtn" class="btn btn-primary"
|
|
|
|
value="<spring:message code="DELETE__ACCOUNT"/>"/>
|
2014-02-09 08:54:36 +01:00
|
|
|
</div>
|
2014-01-10 02:38:59 +01:00
|
|
|
</form>
|
|
|
|
</div>
|
2012-06-20 18:28:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$('#changePasswordMsg').hide();
|
2012-06-23 21:15:59 +02:00
|
|
|
$('#changeInfoMsg').hide();
|
2012-06-30 07:26:21 +02:00
|
|
|
$('#languageMsg').hide();
|
2012-06-23 21:15:59 +02:00
|
|
|
|
2014-01-30 02:17:25 +01:00
|
|
|
function postChange(url, postBody, onSuccess, onError, type) {
|
2012-06-20 18:28:45 +02:00
|
|
|
// Change success message ...
|
|
|
|
jQuery.ajax(url, {
|
2013-03-17 22:51:33 +01:00
|
|
|
async: false,
|
|
|
|
dataType: 'json',
|
|
|
|
data: postBody,
|
2014-01-30 02:17:25 +01:00
|
|
|
type: type ? type : 'PUT',
|
2013-03-17 22:51:33 +01:00
|
|
|
contentType: "text/plain; charset=utf-8",
|
|
|
|
success: function (data, textStatus, jqXHR) {
|
2014-01-30 02:17:25 +01:00
|
|
|
onSuccess()
|
2012-06-20 18:28:45 +02:00
|
|
|
},
|
2013-03-17 22:51:33 +01:00
|
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
2014-01-30 02:17:25 +01:00
|
|
|
onError(textStatus)
|
2012-06-20 18:28:45 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-06-30 07:26:21 +02:00
|
|
|
$('#changePasswordForm').submit(function (event) {
|
2012-06-20 18:28:45 +02:00
|
|
|
var inputVal = $('#changePasswordForm #password').val();
|
|
|
|
var rinputVal = $('#changePasswordForm #repassword').val();
|
2014-01-30 02:17:25 +01:00
|
|
|
var changePasswordMsg = $('#changePasswordMsg');
|
2012-06-20 18:28:45 +02:00
|
|
|
if (inputVal != rinputVal) {
|
|
|
|
// Password mismatch message ...
|
2014-02-09 06:19:59 +01:00
|
|
|
changePasswordMsg.removeClass('alert-info').addClass('alert-danger').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
changePasswordMsg.text('<spring:message code="PASSWORD_MISSMATCH"/>');
|
2012-06-20 18:28:45 +02:00
|
|
|
} else {
|
2014-01-30 02:17:25 +01:00
|
|
|
postChange(
|
|
|
|
"c/restful/account/password",
|
|
|
|
inputVal,
|
2014-02-12 03:27:46 +01:00
|
|
|
function () {
|
2014-02-09 06:19:59 +01:00
|
|
|
changePasswordMsg.removeClass('alert-danger').addClass('alert-info').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
changePasswordMsg.text('<spring:message code="CHANGE_PASSWORD_SUCCESS"/>');
|
|
|
|
},
|
2014-02-12 03:27:46 +01:00
|
|
|
function (textStatus) {
|
2014-02-09 06:19:59 +01:00
|
|
|
changePasswordMsg.removeClass('alert-info').addClass('alert-danger').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
changePasswordMsg.text(textStatus);
|
|
|
|
}
|
|
|
|
);
|
2012-06-20 18:28:45 +02:00
|
|
|
}
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
2012-06-30 07:26:21 +02:00
|
|
|
$('#changeUserForm').submit(function (event) {
|
2014-01-30 02:17:25 +01:00
|
|
|
var firstname = $('#changeUserForm #firstname').val();
|
2012-06-20 18:28:45 +02:00
|
|
|
var lastname = $('#changeUserForm #lastname').val();
|
2014-01-30 02:17:25 +01:00
|
|
|
var changeInfoMsg = $('#changeInfoMsg');
|
|
|
|
postChange(
|
|
|
|
"c/restful/account/firstname",
|
|
|
|
firstname,
|
2014-02-12 03:27:46 +01:00
|
|
|
function () {
|
2014-01-30 02:17:25 +01:00
|
|
|
var changeInfoMsg = $('#changeInfoMsg');
|
|
|
|
changeInfoMsg.removeClass('alert-error').addClass('alert-info').show();
|
|
|
|
changeInfoMsg.text('<spring:message code="INFO_UPDATE_SUCCESS"/>');
|
|
|
|
},
|
2014-02-12 03:27:46 +01:00
|
|
|
function (textStatus) {
|
2014-02-09 06:19:59 +01:00
|
|
|
changeInfoMsg.removeClass('alert-info').addClass('alert-danger').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
changeInfoMsg.text(textStatus);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
postChange(
|
|
|
|
"c/restful/account/lastname",
|
|
|
|
lastname,
|
2014-02-12 03:27:46 +01:00
|
|
|
function () {
|
2014-02-09 06:19:59 +01:00
|
|
|
changeInfoMsg.removeClass('alert-danger').addClass('alert-info').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
changeInfoMsg.text('<spring:message code="INFO_UPDATE_SUCCESS"/>');
|
|
|
|
},
|
2014-02-12 03:27:46 +01:00
|
|
|
function (textStatus) {
|
2014-02-09 06:19:59 +01:00
|
|
|
changeInfoMsg.removeClass('alert-info').addClass('alert-danger').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
changeInfoMsg.text(textStatus);
|
|
|
|
}
|
|
|
|
);
|
2012-06-20 18:28:45 +02:00
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
2012-06-30 07:26:21 +02:00
|
|
|
$('#languageForm').submit(function (event) {
|
|
|
|
|
|
|
|
var locale = $('#languageForm option:selected').val();
|
2014-01-30 02:17:25 +01:00
|
|
|
var languageMsg = $('#languageMsg');
|
|
|
|
postChange(
|
|
|
|
"c/restful/account/locale",
|
|
|
|
locale,
|
2014-02-12 03:27:46 +01:00
|
|
|
function () {
|
2014-02-09 06:19:59 +01:00
|
|
|
languageMsg.removeClass('alert-danger').addClass('alert-info').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
languageMsg.text('<spring:message code="INFO_UPDATE_SUCCESS"/>');
|
|
|
|
},
|
2014-02-12 03:27:46 +01:00
|
|
|
function (textStatus) {
|
2014-02-09 06:19:59 +01:00
|
|
|
languageMsg.removeClass('alert-info').addClass('alert-danger').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
languageMsg.text(textStatus);
|
|
|
|
}
|
|
|
|
);
|
2012-06-30 07:26:21 +02:00
|
|
|
event.preventDefault();
|
|
|
|
});
|
2014-01-10 02:38:59 +01:00
|
|
|
|
|
|
|
$('#deleteAccountForm').submit(function (event) {
|
|
|
|
var locale = $('#deleteAccountForm option:selected').val();
|
2014-01-30 02:17:25 +01:00
|
|
|
postChange(
|
|
|
|
"c/restful/account",
|
|
|
|
locale,
|
2014-02-12 03:27:46 +01:00
|
|
|
function () {
|
2014-01-30 02:17:25 +01:00
|
|
|
window.location.href = "/c/logout"
|
|
|
|
},
|
2014-02-12 03:27:46 +01:00
|
|
|
function (textStatus) {
|
2014-01-30 02:17:25 +01:00
|
|
|
var deleteAccountMsg = $('#deleteAccountMsg');
|
2014-02-09 06:19:59 +01:00
|
|
|
deleteAccountMsg.removeClass('alert-info').addClass('alert-danger').show();
|
2014-01-30 02:17:25 +01:00
|
|
|
deleteAccountMsg.text(textStatus);
|
|
|
|
},
|
|
|
|
'DELETE'
|
|
|
|
)
|
2014-01-10 02:38:59 +01:00
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
2012-06-20 18:28:45 +02:00
|
|
|
</script>
|