mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
moved registration process to instant with no email confirmation
This commit is contained in:
parent
27ab6950a0
commit
fbeedec694
@ -5,7 +5,6 @@
|
||||
/// <reference path="app/accounts/accountsmodule.js" />
|
||||
/// <reference path="app/accounts/accountspasswordhintcontroller.js" />
|
||||
/// <reference path="app/accounts/accountsRegisterController.js" />
|
||||
/// <reference path="app/accounts/accountsRegisterFinalizeController.js" />
|
||||
/// <reference path="app/apiInterceptor.js" />
|
||||
/// <reference path="app/app.js" />
|
||||
/// <reference path="app/config.js" />
|
||||
|
@ -1,12 +1,30 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsRegisterController', function ($scope, $rootScope, apiService) {
|
||||
.controller('accountsRegisterController', function ($scope, $location, apiService, cryptoService, validationService) {
|
||||
var params = $location.search();
|
||||
|
||||
$scope.success = false;
|
||||
$scope.model = {
|
||||
email: params.email
|
||||
};
|
||||
|
||||
$scope.registerPromise = null;
|
||||
$scope.register = function (model) {
|
||||
$scope.registerPromise = apiService.accounts.registerToken({ email: model.email }, function () {
|
||||
$scope.register = function (form) {
|
||||
if ($scope.model.masterPassword != $scope.model.confirmMasterPassword) {
|
||||
validationService.addError(form, 'ConfirmMasterPassword', 'Master password confirmation does not match.', true);
|
||||
return;
|
||||
}
|
||||
|
||||
var key = cryptoService.makeKey($scope.model.masterPassword, $scope.model.email);
|
||||
var request = {
|
||||
name: $scope.model.name,
|
||||
email: $scope.model.email,
|
||||
masterPasswordHash: cryptoService.hashPassword($scope.model.masterPassword, key),
|
||||
masterPasswordHint: $scope.model.masterPasswordHint
|
||||
};
|
||||
|
||||
$scope.registerPromise = apiService.accounts.register(request, function () {
|
||||
$scope.success = true;
|
||||
}).$promise;
|
||||
};
|
||||
|
@ -1,48 +0,0 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsRegisterFinalizeController', function ($scope, $rootScope, $location, $state, apiService, cryptoService, validationService) {
|
||||
var params = $location.search();
|
||||
|
||||
if (!params.token || !params.email) {
|
||||
$state.go('frontend.login.info');
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.success = false;
|
||||
$scope.model = {
|
||||
email: params.email,
|
||||
token: params.token
|
||||
};
|
||||
|
||||
$scope.info = function () {
|
||||
$scope.model.confirmMasterPassword = null;
|
||||
$state.go('frontend.registerFinalize.confirm');
|
||||
};
|
||||
|
||||
$scope.confirmPromise = null;
|
||||
$scope.confirm = function (form) {
|
||||
if ($scope.model.masterPassword != $scope.model.confirmMasterPassword) {
|
||||
validationService.addError(form, 'ConfirmMasterPassword', 'Master password confirmation does not match.', true);
|
||||
return;
|
||||
}
|
||||
|
||||
var key = cryptoService.makeKey($scope.model.masterPassword, $scope.model.email);
|
||||
var request = {
|
||||
token: $scope.model.token,
|
||||
name: $scope.model.name,
|
||||
email: $scope.model.email,
|
||||
masterPasswordHash: cryptoService.hashPassword($scope.model.masterPassword, key),
|
||||
masterPasswordHint: $scope.model.masterPasswordHint
|
||||
};
|
||||
|
||||
$scope.confirmPromise = apiService.accounts.register(request, function () {
|
||||
$scope.success = true;
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.loadInfo = function () {
|
||||
$scope.model.masterPassword = null;
|
||||
window.history.back();
|
||||
};
|
||||
});
|
@ -6,11 +6,12 @@
|
||||
<p class="login-box-msg">Register for a new account.</p>
|
||||
<div class="text-center" ng-show="success">
|
||||
<div class="callout callout-success">
|
||||
<h4>Almost done!</h4> Check your email ({{model.email}}) to complete your registration.
|
||||
<h4>You're Registered!</h4>
|
||||
<p>You may now log in to your new account.</p>
|
||||
</div>
|
||||
<a ui-sref="frontend.login.info">Ready to log in?</a>
|
||||
</div>
|
||||
<form name="registerForm" ng-submit="registerForm.$valid && register(model)" ng-show="!success" api-form="registerPromise">
|
||||
<form name="registerForm" ng-submit="registerForm.$valid && register(registerForm)" ng-show="!success" api-form="registerPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="registerForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<ul>
|
||||
@ -21,6 +22,32 @@
|
||||
<label for="email" class="sr-only">Email</label>
|
||||
<input type="email" id="email" name="Email" class="form-control" placeholder="Email" ng-model="model.email" required api-field />
|
||||
<span class="fa fa-envelope form-control-feedback"></span>
|
||||
<p class="help-block">You'll use your email address to log in.</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="name" class="sr-only">Your Name</label>
|
||||
<input type="text" id="name" name="Name" class="form-control" ng-model="model.name" placeholder="Your Name" required api-field>
|
||||
<span class="fa fa-user form-control-feedback"></span>
|
||||
<p class="help-block">What should we call you?</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="masterPassword" class="sr-only">Master Password</label>
|
||||
<input type="password" id="masterPassword" name="MasterPasswordHash" class="form-control" ng-model="model.masterPassword" placeholder="Master Password" required api-field>
|
||||
<span class="fa fa-lock form-control-feedback"></span>
|
||||
<p class="help-block">The master password is the password you use to access your vault.</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label form="confirmMasterPassword" class="sr-only">Re-type Master Password</label>
|
||||
<input type="password" id="confirmMasterPassword" name="ConfirmMasterPassword" class="form-control" placeholder="Re-type Master Password"
|
||||
ng-model="model.confirmMasterPassword" required api-field>
|
||||
<span class="fa fa-lock form-control-feedback"></span>
|
||||
<p class="help-block">It is very important that you do not forget your master password. There is <u>no way</u> to recover the password in the event that you forget it.</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="hint" class="sr-only">Master Password Hint</label>
|
||||
<input type="text" id="hint" name="MasterPasswordHint" class="form-control" ng-model="model.masterPasswordHint" placeholder="Master Password Hint" api-field>
|
||||
<span class="fa fa-lightbulb-o form-control-feedback"></span>
|
||||
<p class="help-block">A master password hint can help you remember your password if you forget it.</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
|
@ -1,7 +0,0 @@
|
||||
<div class="register-box">
|
||||
<div class="register-logo">
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="register-box-body" ui-view>
|
||||
</div>
|
||||
</div>
|
@ -1,35 +0,0 @@
|
||||
<p class="login-box-msg">Confirm your master password.</p>
|
||||
<div class="text-center" ng-show="success">
|
||||
<div class="callout callout-success">
|
||||
<h4>You're Registered!</h4>
|
||||
<p>You may now log in to your new account.</p>
|
||||
</div>
|
||||
<a ui-sref="frontend.login.info">Ready to log in?</a>
|
||||
</div>
|
||||
<form name="finalizeConfirmForm" ng-submit="finalizeConfirmForm.$valid && confirm(finalizeConfirmForm)" ng-show="!success"
|
||||
api-form="confirmPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="finalizeConfirmForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in finalizeConfirmForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label form="confirmMasterPassword" class="sr-only">Re-type Master Password</label>
|
||||
<input type="password" id="confirmMasterPassword" name="ConfirmMasterPassword" class="form-control" placeholder="Re-type Master Password"
|
||||
ng-model="model.confirmMasterPassword" api-field>
|
||||
<span class="fa fa-lock form-control-feedback"></span>
|
||||
<p class="help-block">It is very important that you do not forget your master password. There is no way to recover the password in the event that you forget it.</p>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<a href="#" ng-click="loadInfo()"><i class="fa fa-arrow-left"></i> Go Back</a>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="finalizeConfirmForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="finalizeConfirmForm.$loading"></i>Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -1,35 +0,0 @@
|
||||
<p class="login-box-msg">Finalize the creation of your new account.</p>
|
||||
<form name="finalizeInfoForm" ng-submit="finalizeInfoForm.$valid && info()">
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="email" class="sr-only">Email</label>
|
||||
<input type="email" id="email" name="Email" class="form-control" ng-model="model.email" placeholder="Email" readonly required>
|
||||
<span class="fa fa-envelope form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="name" class="sr-only">Your Name</label>
|
||||
<input type="text" id="name" name="Name" class="form-control" ng-model="model.name" placeholder="Your Name" required>
|
||||
<span class="fa fa-user form-control-feedback"></span>
|
||||
<p class="help-block">What should we call you?</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="masterPassword" class="sr-only">Master Password</label>
|
||||
<input type="password" id="masterPassword" name="MasterPasswordHash" class="form-control" ng-model="model.masterPassword" placeholder="Master Password" required>
|
||||
<span class="fa fa-lock form-control-feedback"></span>
|
||||
<p class="help-block">The master password is the password you use to access your vault.</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="hint" class="sr-only">Master Password Hint</label>
|
||||
<input type="text" id="hint" name="MasterPasswordHint" class="form-control" ng-model="model.masterPasswordHint" placeholder="Master Password Hint">
|
||||
<span class="fa fa-lightbulb-o form-control-feedback"></span>
|
||||
<p class="help-block">A master password hint can help you remember your password if you forget it.</p>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<a ui-sref="frontend.login.info">Cancel registration</a>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat">Continue</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -114,27 +114,6 @@ angular
|
||||
pageTitle: 'Register',
|
||||
bodyClass: 'register-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.registerFinalize', {
|
||||
controller: 'accountsRegisterFinalizeController',
|
||||
templateUrl: 'app/accounts/views/accountsRegisterFinalize.html',
|
||||
data: {
|
||||
bodyClass: 'register-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.registerFinalize.info', {
|
||||
url: '^/register/finalize',
|
||||
templateUrl: 'app/accounts/views/accountsRegisterFinalizeInfo.html',
|
||||
data: {
|
||||
pageTitle: 'Finalize Registration'
|
||||
}
|
||||
})
|
||||
.state('frontend.registerFinalize.confirm', {
|
||||
url: '^/register/finalize/confirm',
|
||||
templateUrl: 'app/accounts/views/accountsRegisterFinalizeConfirm.html',
|
||||
data: {
|
||||
pageTitle: 'Finalize Registration (Confirm)'
|
||||
}
|
||||
});
|
||||
})
|
||||
.run(function ($rootScope, authService, jwtHelper, tokenService, $state) {
|
||||
|
@ -22,7 +22,6 @@
|
||||
});
|
||||
|
||||
_service.accounts = $resource(_apiUri + '/accounts', {}, {
|
||||
registerToken: { url: _apiUri + '/accounts/register-token', method: 'POST', params: {} },
|
||||
register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} },
|
||||
emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} },
|
||||
email: { url: _apiUri + '/accounts/email', method: 'PUT', params: {} },
|
||||
|
Loading…
Reference in New Issue
Block a user