diff --git a/dashboard/src/js/client.js b/dashboard/src/js/client.js index dc65f3dfe..8de50ae7b 100644 --- a/dashboard/src/js/client.js +++ b/dashboard/src/js/client.js @@ -1913,10 +1913,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout if (error) return callback(error); if (status !== 201) return callback(new ClientError(status, result)); - that.setToken(result.token); - that.setUserInfo({ username: data.username, email: data.email, admin: true, twoFactorAuthenticationEnabled: false, source: '', avatarUrl: null }); - - callback(null, result.activated); + callback(null, result.token); }); }; diff --git a/dashboard/src/js/setup.js b/dashboard/src/js/setup.js index d96d7dac3..ffeba38d5 100644 --- a/dashboard/src/js/setup.js +++ b/dashboard/src/js/setup.js @@ -14,6 +14,7 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client) $scope.view = ''; $scope.initialized = false; $scope.setupToken = ''; + $scope.firstTimeLoginUrl = ''; $scope.owner = { error: null, @@ -36,7 +37,7 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client) setupToken: $scope.setupToken }; - Client.createAdmin(data, function (error) { + Client.createAdmin(data, function (error, autoLoginToken) { if (error && error.statusCode === 400) { $scope.owner.busy = false; @@ -59,6 +60,11 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client) return; } + // set token to autologin on first oidc flow + localStorage.cloudronFirstTimeToken = autoLoginToken; + + $scope.firstTimeLoginUrl = '/openid/auth?client_id=cid-webadmin&scope=openid email profile&response_type=code token&redirect_uri=' + window.location.origin + '/authcallback.html'; + setView('finished'); }); } diff --git a/dashboard/src/js/setupaccount.js b/dashboard/src/js/setupaccount.js index 5e22e3a10..7f5263f81 100644 --- a/dashboard/src/js/setupaccount.js +++ b/dashboard/src/js/setupaccount.js @@ -123,7 +123,7 @@ app.controller('SetupAccountController', ['$scope', '$translate', '$http', funct $http.post(API_ORIGIN + '/api/v1/auth/setup_account', data).success(function (data, status) { if (status !== 201) return error(data, status); - // set token to autologin on first oauth flow + // set token to autologin on first oidc flow localStorage.cloudronFirstTimeToken = data.accessToken; $scope.dashboardUrl = '/openid/auth?client_id=cid-webadmin&scope=openid email profile&response_type=code token&redirect_uri=' + window.location.origin + '/authcallback.html'; diff --git a/dashboard/src/setup.html b/dashboard/src/setup.html index 41e5ffd37..754649221 100644 --- a/dashboard/src/setup.html +++ b/dashboard/src/setup.html @@ -138,7 +138,7 @@
- Proceed to Dashboard + Proceed to Dashboard