update of user data after submission

parent c2fb874a
......@@ -68,6 +68,7 @@ function LoginCtrl(
if (data.user.lang === 'en-us')
data.user.lang = 'en-gb';
$scope.lang = data.user.lang;
;
$translate.use($scope.lang);
} else {
$translate.use($scope.lang);
......@@ -76,7 +77,9 @@ function LoginCtrl(
// user is in the scope of the MainCtrl
$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);
$location.path('/students');
})
......
......@@ -20,21 +20,6 @@ dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl(
if (!$window.sessionStorage.user)
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
$scope.setup = function(){
$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