profile.jsp 8.96 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1
2
<!DOCTYPE html>

3
<%@ include file="/WEB-INF/jsp/init.jsp" %>
Matija Obreza's avatar
Matija Obreza committed
4
5
6

<html>
<head>
Maxym Borodenko's avatar
Maxym Borodenko committed
7
    <title><spring:message code="userprofile.page.title" /></title>
Matija Obreza's avatar
Matija Obreza committed
8
9
</head>
<body>
Matija Obreza's avatar
Matija Obreza committed
10
	<cms:informative-h1 title="userprofile.page.title" fancy="true" info="userprofile.page.intro" />
Matija Obreza's avatar
Matija Obreza committed
11

12
	<security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.id == #user.id)">
13
14
15
		<a href="<c:url value="/profile/${user.uuid}/edit" />" class="btn btn-default pull-right edit-btn">
			<spring:message code="edit" />
		</a>
Matija Obreza's avatar
Matija Obreza committed
16
17
	</security:authorize>

Maxym Borodenko's avatar
Maxym Borodenko committed
18
	<div class="form-horizontal" id="user-profile-info">
Matija Obreza's avatar
Matija Obreza committed
19
20
		<div class="form-group">
			<label for="password" class="col-lg-2 control-label"><spring:message code="user.full-name" /></label>
21
			<div class="col-lg-5 form-control-static"><c:out value="${user.fullName}" /></div>
Matija Obreza's avatar
Matija Obreza committed
22
23
		</div>

24
		<security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.id == #user.id)">
Matija Obreza's avatar
Matija Obreza committed
25
26
			<div class="form-group">
				<label for="password" class="col-lg-2 control-label"><spring:message code="user.email" /></label>
27
				<div class="col-lg-5 form-control-static"><c:out value="${user.email}" /></div>
Matija Obreza's avatar
Matija Obreza committed
28
			</div>
29

30
31
			<div class="form-group">
				<label class="col-lg-2 control-label"><spring:message code="user.account-status" /></label>
32
				<div class="col-lg-5 form-control-static">
33
					<c:if test="${user.accountType == 'SYSTEM'}">SYSTEM</c:if>
Matija Obreza's avatar
Matija Obreza committed
34
35
36
37
					<c:if test="${not user.enabled}"><spring:message code="user.account-disabled" /></c:if>
					<c:if test="${user.accountLocked}"><spring:message code="user.account-locked-until" />
						<fmt:formatDate value="${user.lockedUntil}" type="time" />
					</c:if>
38
				</div>
Matija Obreza's avatar
Matija Obreza committed
39
			</div>
igoshin's avatar
igoshin committed
40

41
42
			<div class="form-group">
				<label class="col-lg-2 control-label"><spring:message code="user.login-type" /></label>
43
				<div class="col-lg-5 form-control-static"><c:out value="${user.accountType}" /></div>
44
45
			</div>

Matija Obreza's avatar
Matija Obreza committed
46
47
			<div class="form-group">
				<label class="col-lg-2 control-label"><spring:message code="user.roles" /></label>
48
				<div class="col-lg-10 form-control-static">
Matija Obreza's avatar
Matija Obreza committed
49
					<c:forEach items="${user.roles}" var="role">
Matija Obreza's avatar
Matija Obreza committed
50
						<div><c:out value="${role}" /></div>
Matija Obreza's avatar
Matija Obreza committed
51
52
53
					</c:forEach>
				</div>
			</div>
54

Matija Obreza's avatar
Matija Obreza committed
55
		</security:authorize>
56

Maxym Borodenko's avatar
Maxym Borodenko committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
        <security:authorize access="hasAnyRole('ADMINISTRATOR', 'VETTEDUSER')">
            <c:if test="${user.ftpPassword ne null}">
                <div class="form-group" id="ftp-credentials">
                    <label class="col-lg-2 control-label"><spring:message code="userprofile.page.ftp-credentials" /></label>
                    <div class="col-lg-5 form-control-static">
                        <div>
                            <label for="ftp-username"><spring:message code="login.username" /></label>
                            <span id="ftp-username"><c:out value="${user.email}" /></span>
                        </div>
                        <div>
                            <label for="ftp-password"><spring:message code="login.password" /></label>
                            <span id="ftp-password">*</span>
                        </div>
                    </div>
                </div>
            </c:if>
        </security:authorize>
74

Matija Obreza's avatar
Matija Obreza committed
75
	</div>
76

Matija Obreza's avatar
Matija Obreza committed
77
	<div class="form-group">
78

79
80
81
	<security:authorize access="hasRole('ADMINISTRATOR')">
		<button class="btn" id="acccount-lock">Lock</button>
		<button class="btn" id="acccount-unlock">Unlock</button>
82

83
84
85
86
		<button class="btn" id="acccount-disable">Disable</button>
		<button class="btn" id="acccount-enable">Enable</button>
	</div>
	</security:authorize>
87
88

    <div class="form-group">
89
                <security:authorize access="hasRole('ADMINISTRATOR') && (isAuthenticated() && principal.id == #user.id)">
90
91
                    <a href="<c:url value="/management/allTokens" />" class="btn btn-default"> <spring:message code="oauth-client.list" /></a>
                </security:authorize>
92
                <security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.id == #user.id)">
93
                    <a href="<c:url value="/management/user/${user.uuid}/tokens" />" class="btn btn-default"><spring:message code="oauth-client.issued.tokens" /></a>
94
                </security:authorize>
95
                <security:authorize access="hasRole('ADMINISTRATOR') || principal.id == #user.id">
Matija Obreza's avatar
Matija Obreza committed
96
                	<c:if test="${not user.hasRole('VALIDATEDUSER')}">
Maxym Borodenko's avatar
Maxym Borodenko committed
97
                    <a href="<c:url value="/profile/${user.uuid}/send"/>" class="btn btn-default">Send validation email</a>
Matija Obreza's avatar
Matija Obreza committed
98
99
                    </c:if>
                </security:authorize>
100
                <security:authorize access="hasAnyRole('VETTEDUSER','ADMINISTRATOR')">
igoshin's avatar
igoshin committed
101
102
                     <a href="<c:url value="/management/addClient" />" class="btn btn-default"><spring:message code="client.details.add" /></a>
                </security:authorize>
Matija Obreza's avatar
Matija Obreza committed
103
104
                <security:authorize access="hasRole('ADMINISTRATOR')">
                	<c:if test="${not user.hasRole('VETTEDUSER')}">
Maxym Borodenko's avatar
Maxym Borodenko committed
105
					<a href="<c:url value="/profile/${user.uuid}/vetted-user"/> " class="btn btn-default">Vetted user</a>
Matija Obreza's avatar
Matija Obreza committed
106
					</c:if>
107
108
109
	                <security:authorize access="isAuthenticated()">
	                    <a href="#" data-toggle="modal"  data-target="#myModal" class="btn btn-default get_widget" id="get_widget">Get Widget</a>
	                </security:authorize>
igoshin's avatar
igoshin committed
110
                </security:authorize>
Maxym Borodenko's avatar
Maxym Borodenko committed
111
112
113
                <security:authorize access="hasAnyRole('ADMINISTRATOR', 'VETTEDUSER')">
                    <input type="button" id="generate-ftp-password-btn" value="<spring:message code="user.generate-ftp-password" />" class="btn btn-default" />
                </security:authorize>
114
115
    </div>

igoshin's avatar
igoshin committed
116
117
118
119
120
121
122
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content"></div>
        </div>
    </div>
    <!--End modal-->
123

124
<content tag="javascript">
125
	<security:authorize access="isAuthenticated()">
Matija Obreza's avatar
Matija Obreza committed
126
127
	<script type="text/javascript">
	jQuery(document).ready(function() {
128

Andrey Lugovskiy's avatar
Andrey Lugovskiy committed
129
130


131
132
133
	<security:authorize access="hasRole('ADMINISTRATOR')">
		$("button#acccount-enable").on("click", function(e) {
			e.preventDefault();
Andrey Lugovskiy's avatar
Andrey Lugovskiy committed
134
            XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
135
136
137
138
139
				window.location.reload();
			}}, true);
		});
		$("button#acccount-disable").on("click", function(e) {
			e.preventDefault();
Andrey Lugovskiy's avatar
Andrey Lugovskiy committed
140
            XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
141
142
143
144
145
				window.location.reload();
			}}, false);
		});
		$("button#acccount-lock").on("click", function(e) {
			e.preventDefault();
Andrey Lugovskiy's avatar
Andrey Lugovskiy committed
146
            XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
147
148
149
150
151
				window.location.reload();
			}}, true);
		});
		$("button#acccount-unlock").on("click", function(e) {
			e.preventDefault();
Andrey Lugovskiy's avatar
Andrey Lugovskiy committed
152
            XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
153
154
155
156
				window.location.reload();
			}}, false);
		});
	</security:authorize>
Maxym Borodenko's avatar
Maxym Borodenko committed
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

    <security:authorize access="hasAnyRole('ADMINISTRATOR', 'VETTEDUSER')">
        $('body').on('click', '#generate-ftp-password-btn', function () {
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '<c:url value="/profile/${user.uuid}/generate-ftp-password" />',
                contentType: 'application/json; charset=utf-8',
                beforeSend: function(xhrObj){
                    xhrObj.setRequestHeader("Accept", "application/json");
                },
                success: function (respObject) {
                    if ($('#ftp-credentials').length) {
                        $('#ftp-password').text(' ' + respObject.password);
                    } else {
                        renderUserFtpCredentials(respObject.password);
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    console.log(textStatus);
                    console.log(errorThrown);
                }
            });
        });

        function renderUserFtpCredentials(password) {
            $('#user-profile-info')
                .append($('<div id="ftp-credentials" />').addClass('form-group')
                    .append($('<label/>').addClass('col-lg-2 control-label').append('<spring:message code="userprofile.page.ftp-credentials" />'))
                    .append($('<div />').addClass('col-lg-5 form-control-static')
                        .append($('<div />')
                            .append($('<label for="ftp-username" />').append('<spring:message code="login.username" />'))
                            .append($('<span id="ftp-username" />').append('<c:out value="${user.email}" />')))
                        .append($('<div />')
                            .append($('<label for="ftp-password" />').append('<spring:message code="login.password" />'))
                            .append($('<span id="ftp-password" />').append(' ' + password)))));
        }
    </security:authorize>

Matija Obreza's avatar
Matija Obreza committed
196
197
	});
	</script>
198
	</security:authorize>
199
</content>
Matija Obreza's avatar
Matija Obreza committed
200
</body>
Andrey Lugovskiy's avatar
Andrey Lugovskiy committed
201
</html>