Commit 60abe756 by Torkel Ödegaard

Merge branch 'v3.1.x'

parents 89c3880a d74eb8c1
......@@ -45,7 +45,7 @@
</li>
<li ng-show="::!ctrl.isSignedIn">
<a href="login" class="sidemenu-item" target="_self">
<a href="{{ctrl.loginUrl}}" class="sidemenu-item">
<span class="icon-circle sidemenu-icon"><i class="fa fa-fw fa-sign-in"></i></span>
<span class="sidemenu-item-text">Sign in</span>
</a>
......
......@@ -12,6 +12,7 @@ export class SideMenuCtrl {
mainLinks: any;
orgMenu: any;
appSubUrl: string;
loginUrl: string;
/** @ngInject */
constructor(private $scope, private $location, private contextSrv, private backendSrv, private $element) {
......@@ -22,13 +23,14 @@ export class SideMenuCtrl {
this.mainLinks = config.bootData.mainNavLinks;
this.openUserDropdown();
this.loginUrl = '/login?redirect=' + encodeURIComponent(this.$location.path());
this.$scope.$on('$routeChangeSuccess', () => {
if (!this.contextSrv.pinned) {
this.contextSrv.sidemenu = false;
}
this.loginUrl = '/login?redirect=' + encodeURIComponent(this.$location.path());
});
}
getUrl(url) {
......
......@@ -70,7 +70,12 @@ function (angular, coreModule, config) {
}
backendSrv.post('/login', $scope.formModel).then(function(result) {
if (result.redirectUrl) {
var params = $location.search();
if (params.redirect && params.redirect[0] === '/') {
window.location.href = config.appSubUrl + params.redirect;
}
else if (result.redirectUrl) {
window.location.href = result.redirectUrl;
} else {
window.location.href = config.appSubUrl + '/';
......
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 to comment