Ask for the user's email if not provided

This commit is contained in:
Johannes Zellner
2015-12-29 11:17:08 +01:00
parent 3060b34bdd
commit ef25f66107
2 changed files with 8 additions and 0 deletions

View File

@@ -222,6 +222,7 @@ app.controller('StepController', ['$scope', '$route', '$location', 'Wizard', fun
app.controller('FinishController', ['$scope', '$location', 'Wizard', 'Client', function ($scope, $location, Wizard, Client) {
$scope.wizard = Wizard;
$scope.setupToken = null;
Client.createAdmin($scope.wizard.username, $scope.wizard.password, $scope.wizard.email, $scope.setupToken, function (error) {
if (error) {
@@ -281,6 +282,9 @@ app.controller('SetupController', ['$scope', '$location', 'Client', 'Wizard', fu
$scope.setupToken = search.setupToken;
Wizard.email = search.email;
// angular ng-attr is only false when 'undefined'
Wizard.requireEmail = search.email || undefined;
}
$location.path('/step1');

View File

@@ -10,6 +10,10 @@
<br/>
<div class="row">
<div class="col-md-4 col-md-offset-4 text-center">
<div ng-hide="wizard.emailPreset" class="form-group" ng-class="{ 'has-error': setup_form.email.$dirty && setup_form.email.$invalid }">
<!-- <label class="control-label" for="inputUsername">Username</label> -->
<input type="email" class="form-control" ng-model="wizard.email" id="inputEmail" name="email" placeholder="Email" ng-enter="focusNext('inputUsername', setup_form.email.$invalid)" ng-attr-autofocus="{{wizard.requireEmail}}" required autocomplete="off">
</div>
<div class="form-group" ng-class="{ 'has-error': setup_form.username.$dirty && setup_form.username.$invalid }">
<!-- <label class="control-label" for="inputUsername">Username</label> -->
<input type="text" class="form-control" ng-model="wizard.username" id="inputUsername" name="username" placeholder="Username" ng-enter="focusNext('inputPassword', setup_form.username.$invalid)" ng-maxlength="512" ng-minlength="3" autofocus required autocomplete="off">