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

[enh] Login with pubkey: add format validation

parent cedf98b3
Branches
Tags
No related merge requests found
......@@ -1332,6 +1332,25 @@ a.underline:hover,
border-bottom: 2px solid red !important;
}
// See login screen (pubkey form)
.item-input.item-button-right {
input,
textarea {
margin-right: 100px;
}
.button,
button {
top: 6px;
}
}
.item-input.item-button-right.item-floating-label {
input,
textarea {
padding-right: 100px;
}
}
/*
* Badge
*/
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -157,7 +157,8 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
return $state.go(next.name, nextParams);
})
.catch(function(err) {
if (err == 'CANCELLED') {
// If cancel, redirect to home, if no current state
if (err == 'CANCELLED' && !$state.current.name) {
return $state.go('app.home');
}
});
......@@ -175,7 +176,8 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
return $state.go(next.name, nextParams);
})
.catch(function(err) {
if (err == 'CANCELLED') {
// If cancel, redirect to home, if no current state
if (err == 'CANCELLED' && !$state.current.name) {
return $state.go('app.home');
}
});
......
......@@ -5,7 +5,7 @@ angular.module('cesium.login.controllers', ['cesium.services'])
;
function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils, UIUtils, Modals, csSettings, Device, parameters) {
function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils, UIUtils, BMA, Modals, csSettings, Device, parameters) {
'ngInject';
parameters = parameters || {};
......@@ -16,6 +16,7 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
$scope.showPubkey = false;
$scope.showComputePubkeyButton = false;
$scope.autoComputePubkey = false;
$scope.pubkeyPattern = '^' + BMA.constants.regexp.PUBKEY + '$';
$scope.isAuth = parameters.auth;
$scope.expectedPubkey = parameters.expectedPubkey;
......@@ -240,6 +241,7 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
console.debug("[login] method changed: ", method);
$scope.formData.method = method;
delete $scope.form.$submitted; // hide form's fields errors
// Scrypt (advanced or not)
if (method == 'SCRYPT_DEFAULT' || method == 'SCRYPT_ADVANCED') {
......
......@@ -3,20 +3,27 @@
</div>
<!-- pubkey -->
<label class="item item-input"
<div class="item item-input item-button-right"
ng-class="{ 'item-input-error': form.$submitted && form.pubkey.$invalid}">
<span class="input-label hidden-xs" translate>COMMON.PUBKEY</span>
<input name="username" type="text" placeholder="{{'LOGIN.PUBKEY_HELP' | translate}}"
<input name="pubkey" type="text" placeholder="{{'LOGIN.PUBKEY_HELP' | translate}}"
ng-model="formData.pubkey"
ng-model-options="{ debounce: 650 }"
ng-pattern="pubkeyPattern"
required >
</label>
<a class="button button-stable icon ion-android-search ink"
ng-click="showWotLookupModal()">
</a>
</div>
<div class="form-errors"
ng-show="form.$submitted && form.pubkey.$error"
ng-messages="form.pubkey.$error">
<div class="form-error" ng-message="required">
<span translate="ERROR.FIELD_REQUIRED"></span>
</div>
<div class="form-error" ng-message="pattern">
<span translate="ERROR.INVALID_PUBKEY"></span>
</div>
</div>
<!-- remember me (checkbox)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment