update of user data after submission

parent c2fb874a
...@@ -68,6 +68,7 @@ function LoginCtrl( ...@@ -68,6 +68,7 @@ function LoginCtrl(
if (data.user.lang === 'en-us') if (data.user.lang === 'en-us')
data.user.lang = 'en-gb'; data.user.lang = 'en-gb';
$scope.lang = data.user.lang; $scope.lang = data.user.lang;
;
$translate.use($scope.lang); $translate.use($scope.lang);
} else { } else {
$translate.use($scope.lang); $translate.use($scope.lang);
...@@ -76,7 +77,9 @@ function LoginCtrl( ...@@ -76,7 +77,9 @@ function LoginCtrl(
// user is in the scope of the MainCtrl // user is in the scope of the MainCtrl
$scope.user = JSON.parse(JSON.stringify(data.user)); $scope.user = JSON.parse(JSON.stringify(data.user));
$scope.user.name = $scope.user.name || $translate.instant('name');
$scope.user.surname = $scope.user.surname || $translate.instant('surname');
$window.sessionStorage.user = JSON.stringify(data.user); $window.sessionStorage.user = JSON.stringify(data.user);
$location.path('/students'); $location.path('/students');
}) })
......
...@@ -20,21 +20,6 @@ dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl( ...@@ -20,21 +20,6 @@ dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl(
if (!$window.sessionStorage.user) if (!$window.sessionStorage.user)
return $scope.logout(); return $scope.logout();
var user = JSON.parse($window.sessionStorage.user);
// Assign values this way (like an object) to ensure it's the parent scope
$scope.user.id = user.id;
$scope.user.role = user.role;
$scope.user.name = user.name || $translate.instant('name');
$scope.user.surname = user.surname || $translate.instant('surname');
$scope.user.pic = user.pic;
$scope.user.lang = user.lang;
$scope.user.isOffice = user.isOffice;
$scope.user.isTutor = user.isTutor;
$scope.user.isAdmin = user.isAdmin;
$scope.user.isTherapist = user.isTherapist;
$scope.user.arasaacLicense = user.arasaacLicense;
// Link to setup // Link to setup
$scope.setup = function(){ $scope.setup = function(){
$location.path('/setup'); $location.path('/setup');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment