Skip to content
Snippets Groups Projects
Commit d479a579 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

New account wizard: fix "show pubkey" button hide/show

parent 1906d5f9
No related branches found
No related tags found
No related merge requests found
......@@ -138,10 +138,10 @@ function NewAccountWizardController($scope, $ionicModal, $state, $ionicSideMenuD
$scope.showAccountPubkey = function() {
$scope.accountData.computing=true;
CryptoUtils.connect($scope.accountData.username, $scope.accountData.password).then(
function(keypair) {
$scope.accountData.pubkey = CryptoUtils.util.encode_base58(keypair.signPk);
$scope.accountData.computing=false;
}
function(keypair) {
$scope.accountData.pubkey = CryptoUtils.util.encode_base58(keypair.signPk);
$scope.accountData.computing=false;
}
)
.catch(function(err) {
$scope.accountData.computing=false;
......@@ -150,6 +150,11 @@ function NewAccountWizardController($scope, $ionicModal, $state, $ionicSideMenuD
});
};
$scope.accountDataChanged = function() {
$scope.accountData.computing=false;
$scope.accountData.pubkey=null;
};
$scope.doNewAccount = function() {
$scope.accountForm.$submitted=true;
if(!$scope.accountForm.$valid) {
......
......@@ -60,6 +60,7 @@
ng-class="{ 'item-input-error': accountForm.$submitted && accountForm.username.$invalid}">
<span class="input-label" translate>LOGIN.USERNAME</span>
<input name="username" type="text" placeholder="{{'LOGIN.USERNAME_HELP' | translate}}"
ng-change="accountDataChanged()"
ng-model="accountData.username"
ng-minlength="8"
required>
......@@ -81,6 +82,7 @@
<span class="input-label" translate>LOGIN.PASSWORD</span>
<input name="password" type="password" placeholder="{{'LOGIN.PASSWORD_HELP' | translate}}"
ng-model="accountData.password"
ng-change="accountDataChanged()"
ng-minlength="8"
required>
</label>
......@@ -99,7 +101,9 @@
<label class="item item-input"
ng-class="{ 'item-input-error': accountForm.$submitted && accountForm.confirmPassword.$invalid}">
<span class="input-label" translate>ACCOUNT.NEW.PASSWORD_CONFIRM</span>
<input name="confirmPassword" type="password" placeholder="{{'ACCOUNT.NEW.PASSWORD_CONFIRM_HELP' | translate}}" ng-model="accountData.confirmPassword" ng-change="loginDataChanged()"
<input name="confirmPassword" type="password"
placeholder="{{'ACCOUNT.NEW.PASSWORD_CONFIRM_HELP' | translate}}"
ng-model="accountData.confirmPassword"
compare-to="accountData.password">
</label>
<div class="form-errors"
......@@ -114,18 +118,20 @@
</div>
<!-- Show public key-->
<div class="item item-icon-left item-button-right">
<i class="icon ion-key"/>
<span translate>COMMON.PUBKEY</span>
<a class="button button-light button-small"
<div class="item item-button-right">
<span class="input-label" translate>COMMON.PUBKEY</span>
<a class="button button-light button-small animate-if"
ng-click="showAccountPubkey()"
ng-if="!accountData.pubkey && accountForm.$valid"
class="animate-if" translate>
ng-if="!(accountData.pubkey || accountData.computing || !accountData.username || !accountData.password)"
translate>
COMMON.BTN_SHOW_PUBKEY
</a>
<span class="item-input" ng-if="accountData.pubkey">
{{accountData.pubkey}}
</span>
<h3 class="gray text-no-wrap" ng-if="accountData.pubkey">
{{accountData.pubkey}}
</h3>
<h3 ng-if="accountData.computing">
<ion-spinner icon="android"></ion-spinner>
</h3>
</div>
</div>
......
......@@ -66,12 +66,12 @@
</div>
<!-- Show public key -->
<div class="item item-icon-left item-button-right left">
<div class="item item-button-right left">
<span class="input-label" translate>COMMON.PUBKEY</span>
<a class="button button-light button-small ink"
<a class="button button-light button-small ink animate-if"
ng-click="showLoginPubkey()"
ng-if="!(loginData.pubkey || loginData.computing || !loginData.username || !loginData.password)"
class="animate-if">
>
{{'COMMON.BTN_SHOW_PUBKEY' | translate}}
</a>
<h3 class="gray text-no-wrap" ng-if="loginData.pubkey">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment