mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
login returnState conditions
This commit is contained in:
parent
cd19e0c9e4
commit
9707fa34e4
@ -7,25 +7,28 @@ angular
|
|||||||
$scope.twoFactorProviderConstants = constants.twoFactorProvider;
|
$scope.twoFactorProviderConstants = constants.twoFactorProvider;
|
||||||
$scope.rememberTwoFactor = { checked: false };
|
$scope.rememberTwoFactor = { checked: false };
|
||||||
|
|
||||||
if ($state.current.name.indexOf('twoFactor') > -1 && (!$scope.twoFactorProviders || !$scope.twoFactorProviders.length)) {
|
$scope.returnState = $state.params.returnState;
|
||||||
$state.go('frontend.login.info', { returnState: returnState });
|
$scope.stateEmail = $state.params.email;
|
||||||
}
|
if (!$scope.returnState && $state.params.org) {
|
||||||
|
$scope.returnState = {
|
||||||
var returnState;
|
|
||||||
if (!$state.params.returnState && $state.params.org) {
|
|
||||||
returnState = {
|
|
||||||
name: 'backend.user.settingsCreateOrg',
|
name: 'backend.user.settingsCreateOrg',
|
||||||
params: { plan: $state.params.org }
|
params: { plan: $state.params.org }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else if (!$scope.returnState && $state.params.premium) {
|
||||||
returnState = $state.params.returnState;
|
$scope.returnState = {
|
||||||
|
name: 'backend.user.settingsPremium'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($state.current.name.indexOf('twoFactor') > -1 && (!$scope.twoFactorProviders || !$scope.twoFactorProviders.length)) {
|
||||||
|
$state.go('frontend.login.info', { returnState: $scope.returnState });
|
||||||
}
|
}
|
||||||
|
|
||||||
var rememberedEmail = $cookies.get(constants.rememberedEmailCookieName);
|
var rememberedEmail = $cookies.get(constants.rememberedEmailCookieName);
|
||||||
if (rememberedEmail || $state.params.email) {
|
if (rememberedEmail || $scope.stateEmail) {
|
||||||
$scope.model = {
|
$scope.model = {
|
||||||
email: $state.params.email ? $state.params.email : rememberedEmail,
|
email: $scope.stateEmail || rememberedEmail,
|
||||||
rememberEmail: rememberedEmail !== null
|
rememberEmail: rememberedEmail !== null
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,7 +70,7 @@ angular
|
|||||||
$scope.twoFactorProvider = getDefaultProvider(twoFactorProviders);
|
$scope.twoFactorProvider = getDefaultProvider(twoFactorProviders);
|
||||||
|
|
||||||
$analytics.eventTrack('Logged In To Two-step');
|
$analytics.eventTrack('Logged In To Two-step');
|
||||||
$state.go('frontend.login.twoFactor', { returnState: returnState }).then(function () {
|
$state.go('frontend.login.twoFactor', { returnState: $scope.returnState }).then(function () {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
$("#code").focus();
|
$("#code").focus();
|
||||||
init();
|
init();
|
||||||
@ -164,8 +167,8 @@ angular
|
|||||||
};
|
};
|
||||||
|
|
||||||
function loggedInGo() {
|
function loggedInGo() {
|
||||||
if (returnState) {
|
if ($scope.returnState) {
|
||||||
$state.go(returnState.name, returnState.params);
|
$state.go($scope.returnState.name, $scope.returnState.params);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$state.go('backend.user.vault');
|
$state.go('backend.user.vault');
|
||||||
|
@ -13,6 +13,12 @@ angular
|
|||||||
params: { plan: $state.params.org }
|
params: { plan: $state.params.org }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (!stateParams.returnState && stateParams.premium) {
|
||||||
|
$scope.returnState = {
|
||||||
|
name: 'backend.user.settingsPremium',
|
||||||
|
params: { plan: $state.params.org }
|
||||||
|
};
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$scope.returnState = stateParams.returnState;
|
$scope.returnState = stateParams.returnState;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a ui-sref="frontend.register({returnState: state.params.returnState, email: state.params.email})">
|
<a ui-sref="frontend.register({returnState: returnState, email: stateEmail})">
|
||||||
Create a new account
|
Create a new account
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -7,7 +7,7 @@ angular
|
|||||||
$locationProvider.hashPrefix('');
|
$locationProvider.hashPrefix('');
|
||||||
jwtOptionsProvider.config({
|
jwtOptionsProvider.config({
|
||||||
urlParam: 'access_token3',
|
urlParam: 'access_token3',
|
||||||
whiteListedDomains: ['api.bitwarden.com', 'preview-api.bitwarden.com', 'localhost', '192.168.1.4']
|
whiteListedDomains: ['api.bitwarden.com', 'preview-api.bitwarden.com', 'localhost', '192.168.1.3']
|
||||||
});
|
});
|
||||||
var refreshPromise;
|
var refreshPromise;
|
||||||
jwtInterceptorProvider.tokenGetter = /*@ngInject*/ function (options, tokenService, authService) {
|
jwtInterceptorProvider.tokenGetter = /*@ngInject*/ function (options, tokenService, authService) {
|
||||||
@ -214,14 +214,16 @@ angular
|
|||||||
controller: 'accountsLoginController',
|
controller: 'accountsLoginController',
|
||||||
params: {
|
params: {
|
||||||
returnState: null,
|
returnState: null,
|
||||||
email: null
|
email: null,
|
||||||
|
premium: null,
|
||||||
|
org: null
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
bodyClass: 'login-page'
|
bodyClass: 'login-page'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('frontend.login.info', {
|
.state('frontend.login.info', {
|
||||||
url: '^/?org',
|
url: '^/?org&premium&email',
|
||||||
templateUrl: 'app/accounts/views/accountsLoginInfo.html',
|
templateUrl: 'app/accounts/views/accountsLoginInfo.html',
|
||||||
data: {
|
data: {
|
||||||
pageTitle: 'Log In'
|
pageTitle: 'Log In'
|
||||||
@ -260,12 +262,14 @@ angular
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('frontend.register', {
|
.state('frontend.register', {
|
||||||
url: '^/register?org',
|
url: '^/register?org&premium',
|
||||||
templateUrl: 'app/accounts/views/accountsRegister.html',
|
templateUrl: 'app/accounts/views/accountsRegister.html',
|
||||||
controller: 'accountsRegisterController',
|
controller: 'accountsRegisterController',
|
||||||
params: {
|
params: {
|
||||||
returnState: null,
|
returnState: null,
|
||||||
email: null
|
email: null,
|
||||||
|
org: null,
|
||||||
|
premium: null
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
pageTitle: 'Register',
|
pageTitle: 'Register',
|
||||||
|
Loading…
Reference in New Issue
Block a user