Merge pull request #2452 from dpalou/MOBILE-3474

MOBILE-3474 login: Limit auto-focus in site and forgotten password
main
Juan Leyva 2020-07-14 12:20:13 +02:00 committed by GitHub
commit 147d106f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -25,7 +25,7 @@
</ion-item>
</div>
<ion-item>
<ion-input type="text" name="value" placeholder="{{ 'core.login.usernameoremail' | translate }}" formControlName="value" autocapitalize="none" autocorrect="off" [core-auto-focus]></ion-input>
<ion-input type="text" name="value" placeholder="{{ 'core.login.usernameoremail' | translate }}" formControlName="value" autocapitalize="none" autocorrect="off" [core-auto-focus]="autoFocus"></ion-input>
</ion-item>
<ion-item>
<button text-wrap ion-button block [disabled]="!myForm.valid">{{ 'core.courses.search' | translate }}</button>

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Component, ViewChild, ElementRef } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams, Platform } from 'ionic-angular';
import { TranslateService } from '@ngx-translate/core';
import { CoreEventsProvider } from '@providers/events';
import { CoreSitesProvider } from '@providers/sites';
@ -35,10 +35,12 @@ export class CoreLoginForgottenPasswordPage {
myForm: FormGroup;
siteUrl: string;
autoFocus: boolean;
constructor(protected navCtrl: NavController,
navParams: NavParams,
fb: FormBuilder,
platform: Platform,
protected translate: TranslateService,
protected loginHelper: CoreLoginHelperProvider,
protected domUtils: CoreDomUtilsProvider,
@ -46,6 +48,7 @@ export class CoreLoginForgottenPasswordPage {
protected sitesProvider: CoreSitesProvider) {
this.siteUrl = navParams.get('siteUrl');
this.autoFocus = platform.is('tablet');
this.myForm = fb.group({
field: ['username', Validators.required],
value: [navParams.get('username') || '', Validators.required]

View File

@ -20,13 +20,13 @@
<ng-container *ngIf="siteSelector == 'url'">
<ion-item>
<ion-label stacked><h2>{{ 'core.login.siteaddress' | translate }}</h2></ion-label>
<ion-input name="url" type="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard"></ion-input>
<ion-input name="url" type="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR"></ion-input>
</ion-item>
</ng-container>
<ng-container *ngIf="siteSelector != 'url'">
<ion-item>
<ion-label stacked><h2>{{ 'core.login.siteaddress' | translate }}</h2></ion-label>
<ion-input name="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard" (ionChange)="searchSite($event, siteForm.value.siteUrl)"></ion-input>
<ion-input name="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard && !showScanQR" (ionChange)="searchSite($event, siteForm.value.siteUrl)"></ion-input>
</ion-item>
<ion-list [class.hidden]="!hasSites && !enteredSiteUrl" class="core-login-site-list">