mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Improve login
This commit is contained in:
@@ -26,7 +26,6 @@ export class LoginPage implements OnInit {
|
|||||||
hasSession = false
|
hasSession = false
|
||||||
setPin = false
|
setPin = false
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private notificatinsservice: NotificationsService,
|
private notificatinsservice: NotificationsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -208,10 +207,13 @@ export class LoginPage implements OnInit {
|
|||||||
|
|
||||||
localStorage.setItem('PIN', encrypted)
|
localStorage.setItem('PIN', encrypted)
|
||||||
|
|
||||||
|
//
|
||||||
// this.router.navigate(['/home/events']);
|
if(window['cy']) {
|
||||||
window.location.pathname = '/home/events'
|
this.router.navigate(['/home/events']);
|
||||||
|
} else {
|
||||||
|
window.location.pathname = '/home/events'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
import { environment } from './../src/environments/environment'
|
import { environment } from './../src/environments/environment'
|
||||||
|
|
||||||
|
|
||||||
|
const windowSet = (page, name, value) => {
|
||||||
|
page.evaluateOnNewDocument(`
|
||||||
|
Object.defineProperty(window, '${name}', {
|
||||||
|
get() {
|
||||||
|
return '${value}'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
export const loginTest = async (page) => {
|
export const loginTest = async (page) => {
|
||||||
await page.setViewport({width: 1200, height: 720});
|
await page.setViewport({width: 1200, height: 720});
|
||||||
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
|
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
|
||||||
@@ -21,6 +31,9 @@ export const loginTest = async (page) => {
|
|||||||
await page.type('input[type="text"]', environment.defaultuser);
|
await page.type('input[type="text"]', environment.defaultuser);
|
||||||
await page.type('input[type="password"]', environment.defaultuserpwd);
|
await page.type('input[type="password"]', environment.defaultuserpwd);
|
||||||
// click and wait for navigation
|
// click and wait for navigation
|
||||||
|
|
||||||
|
windowSet(page, 'cy', true)
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.click('.btn-ok'),
|
page.click('.btn-ok'),
|
||||||
// page.waitForNavigation({ waitUntil: 'networkidle0' }),
|
// page.waitForNavigation({ waitUntil: 'networkidle0' }),
|
||||||
|
|||||||
Reference in New Issue
Block a user