You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/23 11:28:29 UTC
syncope git commit: [SYNCOPE-869] adds a final state to edit/create
user and password reset in case of success - This closes #25
Repository: syncope
Updated Branches:
refs/heads/master 0370ddc65 -> 3d7159e7b
[SYNCOPE-869] adds a final state to edit/create user and password reset in case of success - This closes #25
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3d7159e7
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3d7159e7
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3d7159e7
Branch: refs/heads/master
Commit: 3d7159e7b089d012e9b86c8499ae283859678c29
Parents: 0370ddc
Author: Matteo Di Carlo <ma...@tirasa.net>
Authored: Thu Jun 23 12:51:08 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Thu Jun 23 13:28:10 2016 +0200
----------------------------------------------------------------------
.../resources/META-INF/resources/app/js/app.js | 6 ++-
.../app/js/controllers/UserController.js | 42 ++++++++------------
.../app/js/directives/navigationButtons.js | 4 +-
.../app/js/services/userSelfService.js | 1 +
.../resources/app/languages/de/static.json | 7 +++-
.../resources/app/languages/en/static.json | 6 ++-
.../resources/app/languages/it/static.json | 6 ++-
.../META-INF/resources/app/views/success.html | 33 +++++++++++++++
8 files changed, 73 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
index fc920f2..5bffed2 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
@@ -48,7 +48,7 @@ var app = angular.module('SyncopeEnduserApp', [
app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$translateProvider', '$translatePartialLoaderProvider',
function ($stateProvider, $urlRouterProvider, $httpProvider, $translateProvider, $translatePartialLoaderProvider) {
- $translatePartialLoaderProvider.addPart('static');
+ $translatePartialLoaderProvider.addPart('static');
$translatePartialLoaderProvider.addPart('dynamic');
$translateProvider.useLoader('$translatePartialLoader', {
urlTemplate: 'languages/{lang}/{part}.json'
@@ -112,6 +112,10 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$translate
url: '/finish',
templateUrl: 'views/user-form-finish.html'
})
+ .state('success', {
+ url: '/success',
+ templateUrl: 'views/success.html'
+ })
.state('update', {
url: '/self/update',
templateUrl: 'views/editUser.html',
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
index 3aa009a..a4a3135 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
@@ -17,12 +17,14 @@
* under the License.
*/
+/* global message, component, $state, rootScope */
+
'use strict';
-angular.module("self").controller("UserController", ['$scope', '$rootScope', '$location', '$compile', 'AuthService',
+angular.module("self").controller("UserController", ['$scope', '$rootScope', '$location', '$compile', "$state", 'AuthService',
'UserSelfService', 'SchemaService', 'RealmService', 'ResourceService', 'SecurityQuestionService', 'GroupService',
'AnyService', 'UserUtil', 'GenericUtil', "ValidationExecutor",
- function ($scope, $rootScope, $location, $compile, AuthService, UserSelfService, SchemaService, RealmService,
+ function ($scope, $rootScope, $location, $compile, $state, AuthService, UserSelfService, SchemaService, RealmService,
ResourceService, SecurityQuestionService, GroupService, AnyService, UserUtil, GenericUtil, ValidationExecutor) {
$scope.user = {};
@@ -41,7 +43,6 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
};
$scope.initUser = function () {
-
$scope.dynamicForm = {
plainSchemas: [],
derSchemas: [],
@@ -77,17 +78,13 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var initSchemaValues = function (schemas) {
// initialize plain attributes
for (var i = 0; i < schemas.plainSchemas.length; i++) {
-
var plainSchemaKey = schemas.plainSchemas[i].key;
-
if (!$scope.user.plainAttrs[plainSchemaKey]) {
-
$scope.user.plainAttrs[plainSchemaKey] = {
schema: plainSchemaKey,
values: [],
readonly: schemas.plainSchemas[i].readonly
};
-
// initialize multivalue schema and support table: create mode, only first value
if (schemas.plainSchemas[i].multivalue) {
$scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key] = {
@@ -108,27 +105,20 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
// initialize derived attributes
for (var i = 0; i < schemas.derSchemas.length; i++) {
-
var derSchemaKey = schemas.derSchemas[i].key;
-
if (!$scope.user.derAttrs[derSchemaKey]) {
-
$scope.user.derAttrs[derSchemaKey] = {
schema: derSchemaKey,
values: [],
readonly: true
};
-
}
}
// initialize virtual attributes
for (var i = 0; i < schemas.virSchemas.length; i++) {
-
var virSchemaKey = schemas.virSchemas[i].key;
-
if (!$scope.user.virAttrs[virSchemaKey]) {
-
$scope.user.virAttrs[virSchemaKey] = {
schema: virSchemaKey,
values: [],
@@ -329,20 +319,18 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
// read user from syncope core
readUser();
}
-
};
$scope.saveUser = function (user) {
console.debug("Save user: ", user);
-
var wrappedUser = UserUtil.getWrappedUser(user);
if ($scope.createMode) {
-
UserSelfService.create(wrappedUser, $scope.captchaInput.value).then(function (response) {
- console.info("Created user: ", response);
- $scope.showSuccess("User " + $scope.user.username + " successfully created", $scope.notification);
- $location.path('/self');
+ console.info("User " + $scope.user.username + " SUCCESSFULLY_CREATED");
+ $rootScope.currentUser = $scope.user.username;
+ $rootScope.currentOp = "SUCCESSFULLY_CREATED";
+ $state.go('success');
}, function (response) {
console.error("Error during user creation: ", response);
var errorMessage;
@@ -353,15 +341,15 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
}
$scope.showError("Error: " + (errorMessage || response), $scope.notification);
});
-
} else {
-
UserSelfService.update(wrappedUser, $scope.captchaInput.value).then(function (response) {
console.debug("Updated user: ", response);
AuthService.logout().then(function (response) {
console.info("LOGOUT SUCCESS: ", response);
- $location.path('/self');
- $scope.showSuccess("User " + $scope.user.username + " successfully updated", $scope.notification);
+ console.info("User " + $scope.user.username + " SUCCESSFULLY_UPDATED");
+ $rootScope.currentUser = $scope.user.username;
+ $rootScope.currentOp = "SUCCESSFULLY_UPDATED";
+ $state.go('success');
}, function () {
console.error("LOGOUT FAILED");
});
@@ -402,8 +390,10 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
if (user && user.username) {
$scope.retrieveSecurityQuestion(user);
UserSelfService.passwordReset(user, $scope.captchaInput.value).then(function (data) {
- $scope.showSuccess(data, $scope.notification);
- $location.path('/self');
+ console.info("User " + $scope.user.username);
+ $rootScope.currentUser = $scope.user.username;
+ $rootScope.currentOp = "PASSWORD_UPDATED";
+ $state.go('success');
}, function (response) {
var errorMessage;
// parse error response
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
index 70bd8a8..d8b6986 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
@@ -47,8 +47,7 @@ angular.module('self')
if (ValidationExecutor.validate(currentForm, $scope.$parent)) {
if (state) {
$scope.nextTab(state);
- }
- else if ($scope.wizard) {
+ } else if ($scope.wizard) {
$scope.nextTab($scope.next);
}
}
@@ -58,6 +57,7 @@ angular.module('self')
$scope.nextTab = function (state) {
//change route through parent event
+ console.log("State: ", state);
$state.go(state);
};
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
index 8e70ae3..09a8ac8 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
@@ -42,6 +42,7 @@ angular.module('login')
.then(function (response) {
console.debug("response save: ", response);
var username = response;
+ return username;
}, function (response) {
console.error("Something went wrong during user self creation, exit with status: ", response);
return $q.reject(response.data || response.statusText);
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/languages/de/static.json
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/languages/de/static.json b/client/enduser/src/main/resources/META-INF/resources/app/languages/de/static.json
index 4adba5b..59e6239 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/languages/de/static.json
+++ b/client/enduser/src/main/resources/META-INF/resources/app/languages/de/static.json
@@ -37,6 +37,11 @@
"VIRTUALSCHEMAS": "Virtuelle Schemen",
"RESOURCES": "Ressourcen",
"REALM": "Realm",
- "NEWUSER": "Neuer benutzer"
+ "NEWUSER": "Neuer benutzer",
+ "SUCCESSFULLY_CREATED": "succes aangemaakt",
+ "SUCCESSFULLY_UPDATED": "succesvol ge�pdatet",
+ "PASSWORD_UPDATED": ": password succesfully updated",
+ "GOBACKHOME": "Klik op deze link om terug te gaan naar de home page"
+
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/languages/en/static.json
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/languages/en/static.json b/client/enduser/src/main/resources/META-INF/resources/app/languages/en/static.json
index 44d7abd..a8aa5a8 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/languages/en/static.json
+++ b/client/enduser/src/main/resources/META-INF/resources/app/languages/en/static.json
@@ -37,6 +37,10 @@
"VIRTUALSCHEMAS": "VirtualSchemas",
"RESOURCES": "Resources",
"REALM": "Realm",
- "NEWUSER": "New User"
+ "NEWUSER": "New User",
+ "SUCCESSFULLY_CREATED": "succesfully created",
+ "SUCCESSFULLY_UPDATED": "succesfully updated",
+ "PASSWORD_UPDATED": ": password succesfully updated",
+ "GOBACKHOME": "Click on this link to go back to the home page"
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/languages/it/static.json
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/languages/it/static.json b/client/enduser/src/main/resources/META-INF/resources/app/languages/it/static.json
index bab13cc..f098ca6 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/languages/it/static.json
+++ b/client/enduser/src/main/resources/META-INF/resources/app/languages/it/static.json
@@ -36,5 +36,9 @@
"VIRTUALSCHEMAS": "VirtualSchemas",
"RESOURCES": "Risorse",
"NEWUSER": "Nuovo utente",
- "REALM": "Realm"
+ "REALM": "Realm",
+ "SUCCESSFULLY_CREATED": "creato con successo",
+ "SUCCESSFULLY_UPDATED": "aggiornato con successo",
+ "PASSWORD_UPDATED": ": password succesfully updated",
+ "GOBACKHOME": "Clicca su questo link per tornare alla home page"
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/3d7159e7/client/enduser/src/main/resources/META-INF/resources/app/views/success.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/success.html b/client/enduser/src/main/resources/META-INF/resources/app/views/success.html
new file mode 100644
index 0000000..d9933da
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/success.html
@@ -0,0 +1,33 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<div ng-cloak class="container">
+ <div class="login-container" ng-controller="UserController" ng-init="initUser();" style="box-sizing: border-box; ">
+ <div id="form-container" class="col-md-6 col-md-offset-3" style="box-sizing: border-box; background-color: #F7F7F7;">
+ <div>
+ <div class="page-header" style="text-align: left; font-weight: 700;">
+ <span>{{'USER'| translate}} <b> {{currentUser}}</b> {{currentOp| translate}}</span>
+ </div>
+ <span>
+ <a href="javascript:void(0);" class="btn btn-link" ng-click="logout()">{{'GOBACKHOME'| translate}}</a>
+ </span>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file