diff options
Diffstat (limited to 'portal-auth')
19 files changed, 1785 insertions, 0 deletions
diff --git a/portal-auth/pom.xml b/portal-auth/pom.xml new file mode 100644 index 00000000..f4142c04 --- /dev/null +++ b/portal-auth/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2016 ZTE Corporation. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.openo.gso.gui</groupId> + <artifactId>openo-portal</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>portal-auth</artifactId> + <version>1.1.0-SNAPSHOT</version> + <packaging>war</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + </plugins> + </build> +<name>gso-gui/openo-portal/portal-auth</name></project> diff --git a/portal-auth/src/main/webapp/user/changePassword.html b/portal-auth/src/main/webapp/user/changePassword.html new file mode 100644 index 00000000..7669177a --- /dev/null +++ b/portal-auth/src/main/webapp/user/changePassword.html @@ -0,0 +1,125 @@ +<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/component.css">
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/user.css">
+ <script type="text/javascript" src="/openoui/common/thirdparty/jquery/jquery-1.11.2.min.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/userTools.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/changePassword.js"></script>
+</head>
+
+<body class="hw_body">
+ <div class="mt20" id="progress">
+ <div class="progress_charater">Enter the Password Information</div>
+ <div class="progress_bar"></div>
+ </div>
+ <div id="create_content">
+ <div id="info_content">
+ <table>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>User Name</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="userName" class="fwk_input" disabled="disabled" />
+ </div>
+ </td>
+ <td>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>Old Password</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="oldPassword" class="fwk_input" type="password" />
+ </div>
+ </td>
+ <td>
+ <div id="oldPasswordError" class="errorTip" style="visibility: hidden;">error</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>New Password</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="password" class="fwk_input" type="password" />
+ </div>
+ </td>
+ <td>
+ <div id="passwordError" class="errorTip" style="visibility: hidden;">error.</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>Confirm Password</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="cfPassword" class="fwk_input" type="password" />
+ </div>
+ </td>
+ <td>
+ <div id="cfPsdError" class="errorTip" style="visibility: hidden;">The password is not the same.</div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="role_content" class="suggestion_tip">
+ <div><span class="rule_label">Password Rule:</span></div>
+ <table>
+ <tr>
+ <td><span>1. Contains a minimum of 8 characters and a maximum of 32;</span></td>
+ </tr>
+ <tr>
+ <td><span>2. At least contains: one uppercase letter(A-Z), one lowercase letter(a-z), and one digit(0-9), one special character: ~`@#$%^&*-_=+|?/()<>[]{}",.;'!</span></td>
+ </tr>
+ <tr>
+ <td><span>3. Can not contain any the user name or user name in reverse order;</span></td>
+ </tr>
+ <tr>
+ <td><span>4. Can not contain space.</span></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <div class="button_Group">
+ <button class="fk_button" id="confirm">Confirm</button>
+ <button class="fk_button" id="cancel">Cancel</button>
+ </div>
+</body>
+
+</html>
diff --git a/portal-auth/src/main/webapp/user/createUser.html b/portal-auth/src/main/webapp/user/createUser.html new file mode 100644 index 00000000..68b7edc5 --- /dev/null +++ b/portal-auth/src/main/webapp/user/createUser.html @@ -0,0 +1,141 @@ +<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!doctype html>
+<html>
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/component.css">
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/user.css">
+ <script type="text/javascript" src="/openoui/common/thirdparty/jquery/jquery-1.11.2.min.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/userTools.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/createUser.js"></script>
+</head>
+
+<body class="hw_body">
+ <div class="mt20" id="progress">
+ <div class="progress_charater">Enter Basic Information</div>
+ <div class="progress_bar"></div>
+ </div>
+ <div id="create_content">
+ <div id="info_content">
+ <table>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>User Name</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="userName" class="fwk_input" />
+ </div>
+ </td>
+ <td>
+ <div id="userNameError" class="errorTip" style="visibility: hidden;">error.</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>Password</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="password" class="fwk_input" type="password" />
+ </div>
+ </td>
+ <td>
+ <div id="passwordError" class="errorTip" style="visibility: hidden;">error.</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>Confirm Password</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="cfPassword" class="fwk_input" type="password" />
+ </div>
+ </td>
+ <td>
+ <div id="cfPsdError" class="errorTip" style="visibility: hidden;">error.</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory"></span>
+ </td>
+ <td class="row_interval">
+ <span>Description</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <textarea id="description" class="fwk_textarea"></textarea>
+ </div>
+ </td>
+ <td>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="role_content" class="suggestion_tip">
+ <div><span class="rule_label">User Name Rule:</span></div>
+ <table>
+ <tr>
+ <td><span>1. Contains a minimum of 5 characters and a maximum of 30;</span></td>
+ </tr>
+ <tr>
+ <td><span>2. Contains only alphanumeric characters(a-z\,A-Z\,0-9);</span></td>
+ </tr>
+ <tr>
+ <td><span>3. Can not contain any special characters except "_", which only in the middle of the user name;</span></td>
+ </tr>
+ <tr>
+ <td><span>4. Can not contain space.</span></td>
+ </tr>
+ </table>
+ <div><span class="rule_label">Password Rule:</span></div>
+ <table>
+ <tr>
+ <td><span>1. Contains a minimum of 8 characters and a maximum of 32;</span></td>
+ </tr>
+ <tr>
+ <td><span>2. At least contains: one uppercase letter(A-Z), one lowercase letter(a-z), and one digit(0-9), one special character: ~`@#$%^&*-_=+|?/()<>[]{}",.;'!</span></td>
+ </tr>
+ <tr>
+ <td><span>3. Can not contain any the user name or user name in reverse order;</span></td>
+ </tr>
+ <tr>
+ <td><span>4. Can not contain space.</span></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <div class="button_Group">
+ <button class="fk_button" id="confirm">Confirm</button>
+ <button class="fk_button" id="cancel">Cancel</button>
+ </div>
+</body>
+
+</html>
diff --git a/portal-auth/src/main/webapp/user/css/component.css b/portal-auth/src/main/webapp/user/css/component.css new file mode 100644 index 00000000..4f67b28f --- /dev/null +++ b/portal-auth/src/main/webapp/user/css/component.css @@ -0,0 +1,247 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.button_Group {
+ margin: 15px 0;
+ overflow: hidden;
+}
+
+.fk_button {
+ padding: 0 14px;
+ height: 24px;
+ float: left;
+ cursor: pointer;
+ text-decoration: none;
+ outline: 0;
+ border: 1px solid #d3d3d3;
+ text-align: center;
+ box-shadow: 0 1px 1px rgba(0,0,0,.05);
+ background: #fafafa;
+ background: -moz-linear-gradient(top,#fff,#fafafa);
+ background: -webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(100%,#fafafa));
+ background: -webkit-linear-gradient(top,#fff,#fafafa);
+ background: linear-gradient(to bottom,#fff,#fafafa);
+ border-radius: 6px!important;
+}
+.fk_button:hover {
+ color: #009ae7;
+ border: 1px solid #4AC9FF
+}
+.fk_button:active {
+ color: #0000;
+ border: 1px solid #4AC9FF
+}
+
+.button_Group > button {
+ margin-right: 10px;
+}
+.add_imag {
+ background-image: url(/openoui/user/images/add.png);
+}
+.delete_imag {
+ background-image: url(/openoui/user/images/delete.png);
+}
+.button_imag {
+ padding-left: 25px;
+ background-repeat: no-repeat;
+ background-position: 5px center;
+}
+
+
+/*table style*/
+table.dataTable thead th {
+ padding: 0!important;
+ height: 22px!important;
+ padding: 1px 10px 0 5px;
+ overflow: visible;
+ white-space: nowrap;
+ background: #f0f0f0!important;
+ border: 1px solid #ddd;
+ border-top: 1px solid #e3e3e3!important;
+ border-left: 1px dotted transparent!important;
+ border-bottom: 1px solid #e3e3e3!important;
+ box-sizing: content-box;
+ text-align: left;
+ font-weight:
+}
+table.dataTable tr td {
+ padding: 0 10px 0 5px!important;
+ height: 30px!important;
+ color: #000!important;
+ border: none!important;
+ border-left: 1px solid transparent!important;
+ border-bottom: 1px solid #e3e3e3!important;
+ overflow: hidden!important;
+ white-space: nowrap!important;
+ text-align: left;
+}
+
+table.dataTable th, table.dataTable td {
+ font-size: 12px!important;
+ color: #000!important;
+ max-width: 95%!important;
+ font-weight: 400!important;
+}
+
+.paginate_button {
+ color: #666!important;
+ font-size: 12px!important;
+ font-family: Lucida Grande,Verdana,Arial,Helvetica,sans-serif!important;
+ line-height: 24px!important;
+ text-align: center!important;
+ border: 1px solid #e0e0e0!important;
+ text-decoration: none!important;
+ padding: 0 7px!important;
+ border-radius: 3px!important;
+ background: #fff!important;
+}
+.paginate_button:hover {
+ color: #666!important;
+ border: 1px solid #4ac9ff!important;
+ cursor: pointer!important;
+}
+.current {
+ text-decoration: none!important;
+ color: #fff!important;
+ border: 1px solid #00adf5!important;
+ background: #4ad2ff!important;
+}
+
+/*over write the jquery dataTable*/
+.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
+ color: #666!important;
+}
+.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
+ color: #fff!important;
+}
+table.dataTable tr.odd, table.dataTable tr.odd>.sorting_1 {
+ background-color: #f9f9f9!important;
+}
+table.dataTable tr.even, table.dataTable tr.even>.sorting_1 {
+ background-color: #f7f7f7!important;
+}
+table.dataTable tbody tr:hover, tbody tr.odd>.sorting_1:hover, tbody tr.even>.sorting_1:hover {
+ background-color: #E6FBE0!important;
+}
+table.dataTable.no-footer {
+ border-bottom: none!important;
+}
+
+/*the length information step style*/
+.dataTables_length, .dataTables_info {
+ display: inline-block!important;
+ float: left!important;
+}
+.left {
+ display: inline-block;
+ float: left;
+ overflow: hidden;
+ margin: 10px 20px 10px 5px;
+}
+ .right {
+ display: inline-block;
+ float: right;
+ overflow: hidden;
+ margin-top: 10px;
+}
+.dataTables_length, .dataTables_info {
+ display: inline-block;!important;
+ float: left!important;
+ clear: none!important;
+ padding-top: 0!important;
+}
+.dataTables_length label {
+ font-size: 0;
+}
+
+/*page select style*/
+.dataTables_length select {
+ height: 22px;
+ line-height: 22px;
+ text-align: center;
+ margin-right: 5px;
+ border: 1px solid #e0e0e0;
+ color: #000;
+ padding: 1px;
+}
+.dataTables_length select:active {
+ text-align: center;
+ margin-right: 5px;
+ border: 1px solid #e0e0e0;
+ color: #000;
+ padding: 1px;
+ border-radius: 5px;
+}
+
+/* input style overwrite*/
+.fwk_input {
+ border: 1px solid #c3c3c3;
+ background-color: #fff;
+ padding: 0 0 0 6px;
+ border-radius: 4px;
+ color: #000;
+ display: inline-block;
+ outline: 0;
+ box-shadow: 1px 1px #f6f6f6 inset;
+ font-size: 12px;
+ background: #fff;
+ height: 24px;
+ width: 300px;
+}
+
+.fwk_input:hover, .fwk_input:focus {
+ border-color: #4ac9ff;
+ box-shadow: 1px 1px rgba(74,201,255,.2) inset;
+}
+.fwk_input[type=password] {
+ -moz-user-select: none;
+ -khtml-user-select: none;
+ user-select: none;
+}
+
+.fwk_input:disabled {
+ background-color: #ededed!important;
+ color: #666;
+ box-shadow: 1px 1px #ededed inset!important;
+ border: 1px solid #e0e0e0!important;
+ resize: none;
+}
+
+/* input style textarea*/
+.fwk_textarea {
+ border: 1px solid #c3c3c3;
+ background-color: #fff;
+ padding: 0 0 0 6px;
+ border-radius: 4px;
+ color: #000;
+ display: inline-block;
+ outline: 0;
+ box-shadow: 1px 1px #f6f6f6 inset;
+ font-size: 12px;
+ background: #fff;
+ height: 72px;
+ width: 300px;
+}
+
+.fwk_textarea:hover, .fwk_textarea:focus {
+ border-color: #4ac9ff;
+ box-shadow: 1px 1px rgba(74,201,255,.2) inset;
+}
+
+
+
+
+
+
diff --git a/portal-auth/src/main/webapp/user/css/user.css b/portal-auth/src/main/webapp/user/css/user.css new file mode 100644 index 00000000..91ab7604 --- /dev/null +++ b/portal-auth/src/main/webapp/user/css/user.css @@ -0,0 +1,95 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+* {
+ font-family: Microsoft Yahei!important;
+ font-size: 12px;
+ color: #333;
+}
+
+.hw_body {
+ background-color: #fafafa!important;
+ padding-left: 15px;
+}
+
+.delete, .changePsd, .edit {
+ padding: 0 10px;
+ cursor: pointer;
+}
+
+.mt20 {
+ margin: 20px;
+}
+
+#progress {
+ position: relative;;
+ display: inline-block;
+}
+
+#serverError {
+ margin-left: 18px;
+}
+
+.mandatory {
+ color: #F00;
+ width: 7px;
+ padding-right: 10px 5px 10px 0;
+}
+
+.row_interval {
+ padding: 10px 10px 10px 0;
+}
+
+.progress_bar {
+ height: 4px;
+ border-radius: 2px;
+ width: 420px;
+ background: -webkit-linear-gradient(left, #6fd330, #29b6eb);
+ background: -o-linear-gradient(right, #6fd330, #29b6eb);
+ background: -moz-linear-gradient(right, #6fd330, #29b6eb);
+ background: linear-gradient(to right, #6fd330, #29b6eb);
+}
+
+.progress_charater {
+ display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ color: #1fbe5c;
+ text-align: center;
+ margin-bottom: 20px;
+}
+
+.errorTip {
+ color: red;
+}
+
+.suggestion_tip {
+ height: auto;
+ background-color: #FFF5EA;
+ border: 1px solid #F9DFC5;
+ padding: 8px 10px;
+ margin: 3px 0;
+ color: #333;
+ line-height: 20px;
+ overflow: auto;
+}
+
+.rule_label {
+ font-weight: 600;
+}
+#role_content table {
+ margin-left: 20px;
+}
\ No newline at end of file diff --git a/portal-auth/src/main/webapp/user/images/License.txt b/portal-auth/src/main/webapp/user/images/License.txt new file mode 100644 index 00000000..d1ce787a --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/License.txt @@ -0,0 +1,362 @@ +THIS LICENSE FILE CONTAINS THE LICENSE APPLICABLE DEPENDING ON THE TYPE OF CONTRIBUTIONS.
+
+APACHE LICENSE 2 IS APPLICABLE FOR SOURCE CODE, CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL FOR DOCUMENTATION
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Attribution 4.0 International
+
+https://creativecommons.org/licenses/by/4.0/legalcode
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More_considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+ c. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+ d. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+ f. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+ g. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+ h. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+ i. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+ j. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+ k. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+Section 2 -- Scope.
+
+ a. License grant.
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+ a. reproduce and Share the Licensed Material, in whole or
+ in part; and
+ b. produce, reproduce, and Share Adapted Material.
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+ 5. Downstream recipients.
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+ b. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+ b. Other rights.
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties.
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+ a. Attribution.
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+ ii. a copyright notice;
+ iii. a notice that refers to this Public License;
+ iv. a notice that refers to the disclaimer of
+ warranties;
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+ 4. If You Share Adapted Material You produce, the Adapter's
+ License You apply must not prevent recipients of the Adapted
+ Material from complying with this Public License.
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database;
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material; and
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+ 2. upon express reinstatement by the Licensor.
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
\ No newline at end of file diff --git a/portal-auth/src/main/webapp/user/images/add.png b/portal-auth/src/main/webapp/user/images/add.png Binary files differnew file mode 100644 index 00000000..d1f82993 --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/add.png diff --git a/portal-auth/src/main/webapp/user/images/delete.png b/portal-auth/src/main/webapp/user/images/delete.png Binary files differnew file mode 100644 index 00000000..737f8797 --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/delete.png diff --git a/portal-auth/src/main/webapp/user/images/edit.bak.png b/portal-auth/src/main/webapp/user/images/edit.bak.png Binary files differnew file mode 100644 index 00000000..68d76257 --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/edit.bak.png diff --git a/portal-auth/src/main/webapp/user/images/edit.png b/portal-auth/src/main/webapp/user/images/edit.png Binary files differnew file mode 100644 index 00000000..68d76257 --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/edit.png diff --git a/portal-auth/src/main/webapp/user/images/reset.bak.png b/portal-auth/src/main/webapp/user/images/reset.bak.png Binary files differnew file mode 100644 index 00000000..778b9c0c --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/reset.bak.png diff --git a/portal-auth/src/main/webapp/user/images/reset.png b/portal-auth/src/main/webapp/user/images/reset.png Binary files differnew file mode 100644 index 00000000..d57e9b39 --- /dev/null +++ b/portal-auth/src/main/webapp/user/images/reset.png diff --git a/portal-auth/src/main/webapp/user/js/changePassword.js b/portal-auth/src/main/webapp/user/js/changePassword.js new file mode 100644 index 00000000..068ea561 --- /dev/null +++ b/portal-auth/src/main/webapp/user/js/changePassword.js @@ -0,0 +1,193 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+$(document).ready(function() {
+ var USER_SERVICE = "/openoapi/auth/v1/users";
+ var userId;
+ var $userName = $("#userName");
+ var $oldPassword = $("#oldPassword");
+ var $oldPasswordError = $("#oldPasswordError");
+ var $password = $("#password");
+ var $passwordError = $("#passwordError")
+
+ var $cfPsdError = $("#cfPsdError");
+
+ function initialPage() {
+ userId = getId();
+ getUserDetails(userId).done(function(data) {
+ listUserDetails(data);
+ });
+
+ /*initial the event*/
+ $("#confirm").click(function(e) {
+ if (!checkPassword()) {
+ return;
+ }
+ var data = getModifyUser();
+ changePsd(data).done(function() {
+ top.bootbox.alert("Password change successfully.", function(e) {
+ Rest.turn2URI("/openoui/user/user.html");
+ })
+ }).fail(function(e) {
+ if (e.statusText == "Unauthorized") {
+ showError($oldPasswordError, "The old password is wrong.");
+ } else {
+ showError($oldPasswordError, e.statusText);
+ }
+ })
+ })
+ $("#cancel").click(function(e) {
+ window.document.location = "/openoui/user/user.html";
+ })
+ }
+
+ function checkPassword() {
+ if (!checkMandatory()) {
+ return false;
+ }
+
+ if (!checkCfPassword()) {
+ showError($cfPsdError, "The password is not the same.");
+ return false;
+ }
+
+ if (!checkPasswordRule()) {
+ return false;
+ }
+ return true;
+ }
+
+ function checkMandatory() {
+ if ($password.val() == "") {
+ showError($passwordError, "Mandatory.");
+ return false;
+ }
+
+ if ($oldPassword.val() == "") {
+ showError($oldPasswordError, "Mandatory.");
+ return false;
+ }
+ return true;
+ }
+
+ function checkCfPassword() {
+ return $("#password").val() == $("#cfPassword").val();
+ }
+
+ function checkPasswordRule() {
+ var password = $password.val();
+
+ if (!checkLength(8, 32, password)) {
+ showError($passwordError, "The password length should between 8 and 32.");
+ return false
+ }
+
+ if (!checkCotainSpecial(password)) {
+ showError($passwordError, "At least contain: one uppercase letter, one lowercase letter, and one digit, one special character;");
+ return false
+ }
+
+ if (!checkNoContainAndReverse(password, $userName.val())) {
+ showError($passwordError, "The password should not contain the user name or reverse.");
+ return false
+ }
+
+ if (!checkNoSpace(password)) {
+ showError($passwordError, "The password should not contain space.");
+ return false
+ }
+ return true
+ }
+
+ function checkLength(min, max, str) {
+ return str.length >= min && str.length <= max;
+ }
+
+ function checkOnlySpecials(str, reg) {
+ return str.match(reg) && str.match(reg).length == str.length
+ }
+
+ function checkCotainSpecial(password) {
+ return password.match(/\~|\`|\@|\#|\$|\%|\^|\&|\*|\-|\_|\=|\+|\||\?|\/|\(|\)|\<|\>|\[|\]|\{|\}|\"|\,|\.|\;|\'|\!/g) != null
+ && password.match(/[0-9]/g) != null && password.match(/[a-z]/g) != null && password.match(/[A-Z]/g) != null;
+ }
+
+ function checkUderScore(str) {
+ return str.indexOf("_") != 0 && str.lastIndexOf("_") != str.length - 1;
+ }
+
+ function checkNoSpace(str) {
+ return str.indexOf(" ") == -1;
+ }
+
+ function checkNoContainAndReverse(str, str2) {
+ return str.indexOf(str2) == -1 && str.indexOf(str2.split("").reverse().join("")) == -1;
+ }
+
+ function getModifyUser() {
+ var data = {};
+ data["original_password"] = $("#oldPassword").val();
+ data.password = $("#password").val();
+ return data;
+ }
+
+ function getUserDetails(id) {
+ return Rest.http({
+ url: USER_SERVICE + "/" + id + "?=" + new Date().getTime(),
+ type: "GET",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json"
+ })
+ }
+
+ function listUserDetails(data) {
+ $("#userName").val(data.name);
+ }
+
+
+ function changePsd(data) {
+ return Rest.http({
+ url: USER_SERVICE + "/" + userId + "/password" + "?=" + new Date().getTime(),
+ type: "POST",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json",
+ data: JSON.stringify(data)
+ })
+ }
+
+ function getId() {
+ var qs = location.search;
+ qs = qs.indexOf("?") === 0 ? qs : ("?" + qs);
+ var start = qs.indexOf("id=") + 3;
+ var end = qs.indexOf("&") === -1 ? qs.length : qs.indexOf("&") - start;
+ return qs.substr(start, end);
+ }
+
+ function showError($Obj, message) {
+ $Obj.text(message);
+ $Obj.css("visibility", "visible");
+ setTimeout(function() {
+ hideError($Obj);
+ }, 5000)
+ }
+
+ function hideError($Obj) {
+ $Obj.css("visibility", "hidden");
+ }
+
+ initialPage();
+})
diff --git a/portal-auth/src/main/webapp/user/js/createUser.js b/portal-auth/src/main/webapp/user/js/createUser.js new file mode 100644 index 00000000..5c780ab8 --- /dev/null +++ b/portal-auth/src/main/webapp/user/js/createUser.js @@ -0,0 +1,189 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+$(document).ready(function() {
+
+ var USER_SERVICE = "/openoapi/auth/v1/users";
+ var $userName = $("#userName");
+ var $password = $("#password");
+ var $cfPsdError = $("#cfPsdError");
+ var $userNameError = $("#userNameError");
+ var $passwordError = $("#passwordError");
+
+ function initialPage() {
+ /*initial the event*/
+ $("#confirm").click(function(e) {
+ if (!checkUserRules()) {
+ return;
+ }
+ var data = getCreateUser();
+ createUser(data).done(function() {
+ window.document.location = "/openoui/user/user.html";
+ })
+ })
+ $("#cancel").click(function(e) {
+ window.document.location = "/openoui/user/user.html";
+ })
+ }
+
+ function getCreateUser() {
+ var data = {};
+ data.userName = $userName.val();
+ data.password = $password.val();
+ data.description = $("#description").val();
+ data.email = "xxxx@xxxx.com";
+ return data;
+ }
+
+ function createUser(data) {
+ return Rest.http({
+ url: USER_SERVICE + "?=" + new Date().getTime(),
+ type: "POST",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json",
+ data: JSON.stringify(data)
+ })
+ }
+
+ function checkUserRules() {
+ if (!checkMandatory()) {
+ return false;
+ }
+
+ if (!checkCfPassword()) {
+ return false;
+ }
+
+ if (!checkUserNameRule()) {
+ return false;
+ }
+
+ if (!checkPasswordRule()) {
+ return false;
+ }
+ return true;
+ }
+
+ function checkMandatory() {
+ if ($userName.val() == "") {
+ showError($userNameError, "Mandatory.");
+ return false;
+ }
+
+ if ($password.val() == "") {
+ showError($passwordError, "Mandatory.");
+ return false;
+ }
+ return true;
+ }
+
+ function checkUserNameRule() {
+ var username = $userName.val();
+ if (!checkLength(5, 30, username)) {
+ showError($userNameError, "The user name length should between 5 and 30.");
+ return false
+ }
+
+ if (!checkOnlySpecials(username, /[0-9]|[a-z]|[A-Z]|_/g)) {
+ showError($userNameError, "Only Character(a-z\,A-Z\,0-9,_) is allowed.");
+ return false
+ }
+
+ if(!checkUderScore(username)) {
+ showError($userNameError, 'The character "_" is only allowed in the middle of the user name.');
+ return false
+ }
+
+ if (!checkNoSpace(username)) {
+ showError($userNameError, "The user name should not contain space.");
+ return false
+ }
+
+ return true
+ }
+
+ function checkPasswordRule() {
+ var password = $password.val();
+
+ if (!checkLength(8, 32, password)) {
+ showError($passwordError, "The password length should between 8 and 32.");
+ return false
+ }
+
+ if (!checkCotainSpecial(password)) {
+ showError($passwordError, "At least contain: one uppercase letter, one lowercase letter, and one digit, one special character;");
+ return false
+ }
+
+ if (!checkNoContainAndReverse(password, $userName.val())) {
+ showError($passwordError, "The password should not contain the user name or reverse.");
+ return false
+ }
+
+ if (!checkNoSpace(password)) {
+ showError($passwordError, "The password should not contain space.");
+ return false
+ }
+ return true
+ }
+
+ function checkLength(min, max, str) {
+ return str.length >= min && str.length <= max;
+ }
+
+ function checkOnlySpecials(str, reg) {
+ return str.match(reg) && str.match(reg).length == str.length
+ }
+
+ function checkCotainSpecial(password) {
+ return password.match(/\~|\`|\@|\#|\$|\%|\^|\&|\*|\-|\_|\=|\+|\||\?|\/|\(|\)|\<|\>|\[|\]|\{|\}|\"|\,|\.|\;|\'|\!/g) != null
+ && password.match(/[0-9]/g) != null && password.match(/[a-z]/g) != null && password.match(/[A-Z]/g) != null;
+ }
+
+ function checkUderScore(str) {
+ return str.indexOf("_") != 0 && str.lastIndexOf("_") != str.length - 1;
+ }
+
+ function checkNoContainAndReverse(str, str2) {
+ return str.indexOf(str2) == -1 && str.indexOf(str2.split("").reverse().join("")) == -1;
+ }
+
+ function checkNoSpace(str) {
+ return str.indexOf(" ") == -1;
+ }
+
+ function checkCfPassword() {
+ if ($password.val() == $("#cfPassword").val()) {
+ return true;
+ }
+ showError($cfPsdError, "The password is not the same.");
+ return false;
+ }
+
+ function showError($Obj, message) {
+ $Obj.text(message);
+ $Obj.css("visibility", "visible");
+ setTimeout(function() {
+ hideError($Obj);
+ }, 5000)
+ }
+
+ function hideError($Obj) {
+ $Obj.css("visibility", "hidden");
+ }
+
+ initialPage();
+})
diff --git a/portal-auth/src/main/webapp/user/js/modifyUser.js b/portal-auth/src/main/webapp/user/js/modifyUser.js new file mode 100644 index 00000000..7e571448 --- /dev/null +++ b/portal-auth/src/main/webapp/user/js/modifyUser.js @@ -0,0 +1,78 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+$(document).ready(function() {
+ var USER_SERVICE = "/openoapi/auth/v1/users";
+ var userId;
+ function initialPage() {
+ userId = getId();
+ getUserDetails(userId).done(function(data) {
+ listUserDetails(data);
+ });
+
+ /*initial the event*/
+ $("#confirm").click(function(e) {
+ var data = getModifyUser();
+ modifyUser(data).done(function() {
+ window.document.location = "/openoui/user/user.html";
+ })
+ })
+ $("#cancel").click(function(e) {
+ window.document.location = "/openoui/user/user.html";
+ })
+ }
+
+ function getModifyUser() {
+ var data = {};
+ data.description = $("#description").val();
+ data.email = "xxxx@xxxx.com";
+ return data;
+ }
+ function getUserDetails(id) {
+ return Rest.http({
+ url: USER_SERVICE + "/" + id + "?=" + new Date().getTime(),
+ type: "GET",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json"
+ })
+ }
+
+ function listUserDetails(data) {
+ $("#userName").val(data.name);
+ $("#description").val(data.description);
+ }
+
+ function modifyUser(data) {
+ return Rest.http({
+ url: USER_SERVICE + "/" + userId + "?=" + new Date().getTime(),
+ type: "PATCH",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json",
+ data: JSON.stringify(data)
+ })
+ }
+
+ function getId() {
+ var qs = location.search;
+ qs = qs.indexOf("?") === 0 ? qs : ("?" + qs);
+ var start = qs.indexOf("id=") + 3;
+ var end = qs.indexOf("&") === -1 ? qs.length : qs.indexOf("&") - start;
+ return qs.substr(start, end);
+ }
+
+ initialPage();
+})
\ No newline at end of file diff --git a/portal-auth/src/main/webapp/user/js/user.js b/portal-auth/src/main/webapp/user/js/user.js new file mode 100644 index 00000000..7be00a3d --- /dev/null +++ b/portal-auth/src/main/webapp/user/js/user.js @@ -0,0 +1,109 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+$(document).ready(function() {
+ var USER_SERVICE = "/openoapi/auth/v1/users";
+ var deleteEditOpt = "<img class='edit' title='edit' src='/openoui/user/images/edit.png'><img class='changePsd' title='Change Password' src='/openoui/user/images/reset.png'><img class='delete' title='delete' src='/openoui/user/images/delete.png'>";
+ var editOpt = "<img class='edit' title='edit' src='/openoui/user/images/edit.png'><img class='changePsd' title='Change Password' src='/openoui/user/images/reset.png'>";
+
+ var userListHeader = [
+ { title: "User", data: "User",width: "20%"},
+ { title: "Description", data: "Description",width: "60%"},
+ { title: "Operations", data: "Operations",width: "20%"}
+ ];
+ function initialPage() {
+ /*get the user list data;*/
+ getUserList().done(function(data) {
+ var data = formatUsers(data);
+ Table.create(data, "table_id", userListHeader);
+ $(".hw_body").css("visibility", "visible");
+ }).error(function(data) {
+ if (data.status == 403) {
+ $(".hw_body").html("<span style='font-size:20px;'>" + JSON.parse(data.responseText).error.message + "</span>");
+ }
+ });
+
+ /*add the listener*/
+ $("#table_id tbody").on("click", "td", function(e) {
+ var classname = e.target.className;
+ var id = $("#table_id").DataTable().row(this).data().rowid;
+ if (classname == "delete") {
+ top.bootbox.confirm("Are you sure to delete this user?", function(result) {
+ if (result) {
+ deleteUser(id).done(function() {
+ getUserList().done(function(data) {
+ var data = formatUsers(data);
+ var datatable = $("#table_id").dataTable().api();
+ datatable.clear();
+ datatable.rows.add(data);
+ datatable.draw();
+ })
+ })
+ }
+ })
+ } else if (classname == "edit") {
+ window.document.location = "/openoui/user/modifyUser.html" + "?id=" + id;
+ } else if (classname == "changePsd") {
+ window.document.location = "/openoui/user/changePassword.html" + "?id=" + id;
+ }
+ })
+
+ $("#create").click(function(e) {
+ window.document.location = "/openoui/user/createUser.html";
+ })
+ }
+
+ function getUserList() {
+ return Rest.http({
+ url: USER_SERVICE + "?=" + new Date().getTime(),
+ type: "GET",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json"
+ })
+ }
+
+ function deleteUser(id) {
+ return Rest.http({
+ url: USER_SERVICE + "/" + id + "?=" + new Date().getTime(),
+ type: "DELETE",
+ async: false,
+ contentType: 'application/json',
+ dataType: "json"
+ })
+ }
+
+ function formatUsers(data) {
+ var tableData = [];
+ for (var i = 0; i < data.length; i++) {
+ var temp = {};
+ temp.rowid = data[i].id;
+ temp.User = data[i].name;
+ temp.Description = data[i].description;
+ if (data[i].name == "admin") {
+ temp.Operations = editOpt;
+ } else {
+ temp.Operations = deleteEditOpt;
+ }
+ tableData.push(temp);
+ }
+ return tableData;
+ }
+ initialPage();
+
+ setTimeout(function() {
+ Table.enableToolTips("table_id");
+ }, 0)
+});
diff --git a/portal-auth/src/main/webapp/user/js/userTools.js b/portal-auth/src/main/webapp/user/js/userTools.js new file mode 100644 index 00000000..f6aa84ff --- /dev/null +++ b/portal-auth/src/main/webapp/user/js/userTools.js @@ -0,0 +1,88 @@ +/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var Table = {};
+Table.create = function(data, id, columns) {
+ $('#' + id).DataTable({
+ data: data,
+ bSort: false,
+ "sDom": "<t<'left'li><'right'p>>",
+ columns: columns
+ });
+ }
+ /**
+ * update the table data, the cloumns must be same with the create one.
+ * data: the update data. as the create structure
+ * id: the table id.
+ */
+Table.updata = function(data, id) {
+ var datatable = $('#' + id).dataTable().api();
+ datatable.clear();
+ datatable.rows.add(data);
+ datatable.draw();
+}
+
+Table.enableToolTips = function(id) {
+ $("#" + id + " tr th").each(function(index, sdom){
+ sdom.title = sdom.textContent;
+ })
+ $("#" + id + " tbody tr td").each(function(index, sdom){
+ sdom.title = sdom.textContent;
+ })
+}
+
+var Rest = {};
+
+Rest.http = function(setting) {
+ var ret = $.ajax(setting);
+ ret.fail(function(data) {
+ try {
+ if (data.responseText.indexOf("login") != -1) {
+ top.window.document.location.reload()
+ }
+ var result = JSON.parse(data.responseText);
+ if (result.error && result.error.message) {
+ top.bootbox.alert(result.error.message, function() {});
+ }
+ } catch (e) {
+ }
+
+ })
+ return ret;
+}
+
+Rest.turn2URI = function(url) {
+ var cookies = document.cookie.split(";");
+ var cookie = "";
+ for (var i = 0; i < cookies.length; i++) {
+ if (cookies[i].split("=")[0] == "X-Auth-Token") {
+ cookie = cookies[i].split("=")[1];
+ break;
+ }
+ }
+ $.ajax({
+ url: "/openoapi/auth/v1/tokens",
+ type: "HEAD",
+ headers: {
+ "X-Auth-Token": cookie
+ },
+ success: function(data) {
+ window.document.location = url;
+ },
+ error: function(data) {
+ top.window.document.location.reload();
+ }
+ })
+}
diff --git a/portal-auth/src/main/webapp/user/modifyUser.html b/portal-auth/src/main/webapp/user/modifyUser.html new file mode 100644 index 00000000..0609faba --- /dev/null +++ b/portal-auth/src/main/webapp/user/modifyUser.html @@ -0,0 +1,77 @@ +<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!doctype html>
+<html>
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/component.css">
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/user.css">
+ <script type="text/javascript" src="/openoui/common/thirdparty/jquery/jquery-1.11.2.min.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/userTools.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/modifyUser.js"></script>
+
+</head>
+
+<body class="hw_body">
+ <div class="mt20" id="progress">
+ <div class="progress_charater">Enter Basic Information</div>
+ <div class="progress_bar"></div>
+ </div>
+ <div id="create_content">
+ <table>
+ <tr>
+ <td>
+ <span class="mandatory">*</span>
+ </td>
+ <td class="row_interval">
+ <span>User Name</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <input id="userName" class="fwk_input" disabled="disabled"/>
+ </div>
+ </td>
+ <td>
+
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="mandatory"></span>
+ </td>
+ <td class="row_interval">
+ <span>Description</span><span>:</span>
+ </td>
+ <td>
+ <div>
+ <textarea id="description" class="fwk_textarea"></textarea>
+ </div>
+ </td>
+ <td>
+
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="button_Group">
+ <button class="fk_button" id="confirm">Confirm</button>
+ <button class="fk_button" id="cancel">Cancel</button>
+ </div>
+</body>
+
+</html>
diff --git a/portal-auth/src/main/webapp/user/user.html b/portal-auth/src/main/webapp/user/user.html new file mode 100644 index 00000000..7880000c --- /dev/null +++ b/portal-auth/src/main/webapp/user/user.html @@ -0,0 +1,41 @@ +<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!doctype html>
+<html>
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <link rel="stylesheet" type="text/css" href="/openoui/common/thirdparty/data-tables/jquery.dataTables.min.css">
+ <script type="text/javascript" src="/openoui/common/thirdparty/jquery/jquery-1.11.2.min.js"></script>
+ <script type="text/javascript" src="/openoui/common/thirdparty/bootbox/bootbox.min.js"></script>
+ <script type="text/javascript" charset="utf8" src="/openoui/common/thirdparty/data-tables/jquery.dataTables.min.js"></script>
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/component.css">
+ <script type="text/javascript" src="/openoui/user/js/userTools.js"></script>
+ <script type="text/javascript" src="/openoui/user/js/user.js"></script>
+ <link rel="stylesheet" type="text/css" href="/openoui/user/css/user.css">
+</head>
+
+<body class="hw_body" style="visibility: hidden;">
+ <div class="button_Group">
+ <button class="fk_button add_imag button_imag" id="create">Create</button>
+ </div>
+ <div>
+ <table id="table_id"></table>
+ </div>
+</body>
+
+</html>
|