Skip to content

Commit ccd8b80

Browse files
committed
MOBILE-4653 login: Fix contact site support when exceeded attempts
1 parent 8ad3bdb commit ccd8b80

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/core/features/login/tests/behat/basic_usage.feature

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,34 @@ Feature: Test basic usage of login in app
185185
| Password | student1 |
186186
And I press "Log in" near "Lost password?" in the app
187187
Then the header should be "Acceptance test site" in the app
188+
189+
Scenario: Exceeded login attempts
190+
Given the following config values are set as admin:
191+
| supportavailability | 2 |
192+
When I launch the app
193+
And I set the field "Your site" to "$WWWROOT" in the app
194+
And I press "Connect to your site" in the app
195+
And I set the following fields to these values in the app:
196+
| Username | wrong |
197+
| Password | credentials |
198+
And I press "Log in" near "Lost password?" in the app
199+
Then I should find "Invalid login" in the app
200+
201+
When I press "OK" in the app
202+
Then I should not find "Need help logging in?" in the app
203+
204+
When I press "Log in" near "Lost password?" in the app
205+
And I press "OK" in the app
206+
Then I should not find "Need help logging in?" in the app
207+
208+
When I press "Log in" near "Lost password?" in the app
209+
And I press "OK" in the app
210+
Then I should find "Need help logging in?" in the app
211+
212+
When I press "recovering your password" in the app
213+
Then I should find "Forgotten password" in the app
214+
And I should find "To reset your password" in the app
215+
216+
When I go back in the app
217+
And I press "Contact support" in the app
218+
Then the app should have opened a browser tab with url ".*\/user\/contactsitesupport\.php"

src/core/features/user/services/support.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { AlertButton } from '@ionic/angular';
2525
import { CoreLang } from '@services/lang';
2626
import { CoreUserNullSupportConfig } from '@features/user/classes/support/null-support-config';
2727
import { CoreAlerts } from '@services/overlays/alerts';
28+
import { CoreOpener } from '@singletons/opener';
2829

2930
/**
3031
* Handle site support.
@@ -40,7 +41,10 @@ export class CoreUserSupportService {
4041
async contact(options: CoreUserSupportContactOptions = {}): Promise<void> {
4142
const supportConfig = options.supportConfig ?? CoreUserAuthenticatedSupportConfig.forCurrentSite();
4243
const supportPageUrl = supportConfig.getSupportPageUrl();
43-
const browser = await CoreSites.getCurrentSite()?.openInAppWithAutoLogin(supportPageUrl);
44+
const currentSite = CoreSites.getCurrentSite();
45+
const browser = await (currentSite ?
46+
currentSite.openInAppWithAutoLogin(supportPageUrl) :
47+
CoreOpener.openInApp(supportPageUrl));
4448

4549
if (browser && supportPageUrl.endsWith('/user/contactsitesupport.php')) {
4650
this.populateSupportForm(browser, options.subject, options.message);

0 commit comments

Comments
 (0)