Fix notification and validation messages when creating and importing a profile.

This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-02 18:53:14 -03:00
parent 0060c9a0c9
commit 7f89772c86
5 changed files with 32 additions and 25 deletions

View File

@ -379,7 +379,6 @@ a:hover {
height: 41px;
position: relative;
font-size: 12px;
width: 70%;
padding: 0.9rem 0.7rem 0.7rem 3rem;
border-radius: 4px;
background: #F2F5F8;
@ -388,7 +387,6 @@ a:hover {
}
.box-notification .box-icon {
margin-right: 77px;
position: absolute;
top: 0;
left: 0;

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, notification, pluginManager, identityService) {
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, $timeout, notification, pluginManager, identityService) {
identityService.goWalletHome();
$scope.createProfile = function(form) {
@ -17,7 +17,16 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
if (msg.indexOf('EEXIST')>=0 || msg.indexOf('BADC')>=0 ) {
msg = 'This profile already exists'
}
$scope.error = msg;
$timeout(function() {
form.email.$setViewValue('');
form.email.$render();
form.password.$setViewValue('');
form.password.$render();
form.repeatpassword.$setViewValue('');
form.repeatpassword.$render();
form.$setPristine();
$scope.error = msg;
},1);
}
});
}

View File

@ -29,7 +29,6 @@ angular.module('copayApp.controllers').controller('ImportProfileController',
} else {
$scope.error = 'Unknown error';
}
$rootScope.$digest();
}
});
};

View File

@ -18,7 +18,7 @@
<div ng-include="'views/includes/version.html'"></div>
</div>
<div class="box-setup">
<h3 class="text-center" translate>Create Profile</h3>
<h1>Create Profile</h1>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
@ -28,15 +28,14 @@
</span>
</div>
<form name="profileForm" ng-submit="createProfile(profileForm)" novalidate>
<div class="row">
<label class="left" for="insightLivenet">Email</label>
<span translate class="has-error right size-12" ng-show="profileForm.email.$invalid &&
!profileForm.email.$pristine || error">
<div class="m5b text-right">
<span translate class="has-error size-12" ng-show="profileForm.email.$invalid &&
!profileForm.email.$pristine">
<span class="icon-input"><i class="fi-x"></i></span>
Not valid
</span>
<span class="icon-input right" ng-show="!profileForm.email.$invalid &&
!profileForm.email.$pristine || error"><i class="fi-check"></i></span>
<span class="icon-input" ng-show="!profileForm.email.$invalid &&
!profileForm.email.$pristine"><i class="fi-check"></i></span>
</div>
<div class="input">
<input type="email" ng-model="email" class="form-control fi-email"
@ -44,31 +43,30 @@
<i class="icon-email"></i>
</div>
<label for="insightLivenet">Password</label>
<div class="input">
<input id="password" type="password" ng-model="$parent.password"
class="form-control" name="password" placeholder="{{'Choose a password'|translate}}" check-strength="passwordStrength"
tooltip-html-unsafe="Password strength: <b>{{passwordStrength}}</b><br/><span class='size-12'>Tip: Use lower and uppercase, numbers and symbols</span>" tooltip-trigger="focus" required tooltip-placement="right">
tooltip-html-unsafe="Password strength: <b>{{passwordStrength}}</b><br/><span class='size-12'>Tip: Use lower and uppercase, numbers and symbols</span>" tooltip-trigger="focus" required tooltip-placement="top">
<i class="icon-locked"></i>
</div>
<div class="row">
<label class="left" for="insightLivenet">Confirm Password</label>
<span translate class="has-error right size-12" ng-show="profileForm.repeatpassword.$dirty &&
<div class="m5b text-right">
<span translate class="has-error size-12" ng-show="profileForm.repeatpassword.$dirty &&
profileForm.repeatpassword.$invalid">
<span class="icon-input"><i class="fi-x"></i></span>
{{'Passwords must match'|translate}}
</span>
<span class="icon-input right" ng-show="profileForm.repeatpassword.$dirty &&
<span class="icon-input" ng-show="profileForm.repeatpassword.$dirty &&
!profileForm.repeatpassword.$invalid"><i class="fi-check"></i></span>
</div>
<div class="input">
<input type="password" ng-model="repeatpassword"
class="input form-control" name="repeatpassword"
placeholder="{{'Repeat password'|translate}}"
match="password" required>
<i class="icon-locked"></i>
</div>
</div>
<button translate type="submit" class="button primary radius expand m0"
ng-disabled="profileForm.$invalid || loading">

View File

@ -21,11 +21,14 @@
<div class="box-setup">
<h1 translate>Import Profile</h1>
<form name="importProfileForm" ng-submit="import(importProfileForm)" novalidate>
<p class="text-warning size-12"
ng-show="error">
<i class="fi-x"></i>
{{error|translate}}
</p>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
</div>
<span class="text-warning size-14">
{{error|translate}}
</span>
</div>
<div ng-show="!is_iOS">
<legend for="backupFile" class="m10b">