fix(login(js)): input focus on TOTP field

This commit is contained in:
Francis Lachapelle
2021-12-07 16:31:28 -05:00
parent 4eed98d58d
commit 56a6f246d6
2 changed files with 8 additions and 3 deletions

View File

@@ -134,7 +134,11 @@
<md-input-container class="md-block">
<label><var:string label:value="Verification Code"/></label>
<md-icon>lock</md-icon>
<input type="text" ng-pattern="app.verificationCodePattern" ng-model="app.creds.verificationCode" ng-required="app.loginState == 'totpcode'"/>
<input type="text"
ng-pattern="app.verificationCodePattern"
ng-model="app.creds.verificationCode"
ng-required="app.loginState == 'totpcode'"
sg-focus-on="totpcode"/>
<div class="sg-hint"><var:string label:value="Enter the 6-digit verification code from your TOTP application."/></div>
</md-input-container>
<div layout="row" layout-align="space-between center">

View File

@@ -9,8 +9,8 @@
/**
* @ngInject
*/
LoginController.$inject = ['$scope', '$window', '$timeout', 'Dialog', '$mdDialog', 'Authentication'];
function LoginController($scope, $window, $timeout, Dialog, $mdDialog, Authentication) {
LoginController.$inject = ['$scope', '$window', '$timeout', 'Dialog', '$mdDialog', 'Authentication', 'sgFocus'];
function LoginController($scope, $window, $timeout, Dialog, $mdDialog, Authentication, focus) {
var vm = this;
this.$onInit = function() {
@@ -43,6 +43,7 @@
if (data.totpmissingkey) {
vm.loginState = 'totpcode';
focus('totpcode');
}
else if (data.totpdisabled) {
vm.loginState = 'totpdisabled';