Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the mock login page #1340

Merged
merged 7 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/e2e-test-application/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ Cypress.Commands.add('visitLoggedIn', (path = '/') => {
Cypress.Commands.add(
'login',
(email, password, skipReturnPathCheck = false) => {
cy.get('.form-input')
cy.get('.fd-input')
.first()
.clear()
.type('tets@email.com')
.should('have.value', 'tets@email.com');

cy.get('.form-input')
cy.get('.fd-input')
.last()
.clear()
.type('tets')
.should('have.value', 'tets');

cy.get('#login-button').click();
cy.get('.fd-button').click();

if (!skipReturnPathCheck) {
cy.get('.fd-shellbar').contains('Overview');
Expand Down
84 changes: 33 additions & 51 deletions test/e2e-test-application/src/assets/auth-mock/login-mock.html
Original file line number Diff line number Diff line change
@@ -1,106 +1,88 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Luigi Mock Identity Provider</title>
<link
rel="stylesheet"
href="../../fundamental-styles/fundamental-styles.css"
/>
<link rel="stylesheet" type="text/css" href="../../styles.css" />
<style type="text/css">
body {
background-color: #f7f7f7;
}

.form-input {
border-radius: 4px;
border: 1px solid #ccc;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
color: #666;
h1 {
text-align: center;
font-weight: 400;
}

.fd-input {
display: block;
font-size: 14px;
height: 20px;
line-height: 1.42857143;
margin: auto;
padding: 6px 12px;
width: 200px;
}

#login-button {
.fd-button {
display: block;
margin: auto;
cursor: pointer;
border-radius: 4px;
font-size: 1rem;
background-color: #ffffff;
color: #0a6ed1;
border: solid 1px #0a6ed1;
padding: 0 10px;
height: 36px;
max-height: 36px;
min-width: 36px;
transition: all 0.125s ease-in;
}

#login-button:hover {
border-color: #085caf;
color: #085caf;
box-shadow: 0 0 0 1px #0a6ed1;
}

.panel {
.login-form {
background-color: #ffffff;
box-shadow: 0 5px 20px 0 rgba(50, 54, 58, 0.08);
border-radius: 4px;
border: none;
width: 50%;
margin: auto;
margin-top: 50px;
min-width: 270px;
padding: 15px;
}

h1 {
text-align: center;
font-size: 1.42857143rem;
line-height: 1.33333333;
font-weight: 400;
display: block;
margin-bottom: 20px;
color: #32363a;
}
</style>
</head>

<body>
<div class="panel">
<div class="login-form">
<h1>Login to Luigi sample app</h1>
<form>
<input
class="fd-input"
type="text"
class="form-input"
placeholder="Username"
value="LuigiUsername"
autocomplete="username"
/><br />
/>
<br />
<input
class="fd-input"
placeholder="Password"
type="password"
class="form-input"
value="LuigiPassword"
autocomplete="current-password"
/><br />
<button id="login-button">Login</button>
/>
<br />
<button class="fd-button">Login</button>
</form>
</div>
<script>
/**
* NOTE: this is a mock implementation for local development. DO NOT USE IN PRODUCTION!
* NOTE: this is a mock implementation for local development. DO NOT USE IT IN PRODUCTION!
*/

window.onload = function() {
var redirectUrl = decodeURIComponent(
const expiresIn = 3600;
let redirectUrl = decodeURIComponent(
window.location.href.match(/redirect_uri=(.*?)(&|$)/)[1]
);
var state = decodeURIComponent(
let state = decodeURIComponent(
window.location.href.match(/state=(.*?)(&|$)/)[1]
);
var expiresIn = 3600;

var goTo =
let goTo =
redirectUrl +
'#expires_in=' +
expiresIn +
Expand All @@ -115,9 +97,9 @@ <h1>Login to Luigi sample app</h1>
In0.YUBE3tufmmNIJHwzKRXlImteuh_qDeuwGjkzN3Z0erg& \
token_type=bearer';

var loginButton = document.getElementById('login-button');
let loginButton = document.getElementsByClassName('fd-button');

loginButton.addEventListener('click', function(ev) {
loginButton[0].addEventListener('click', function(ev) {
ev.preventDefault();
window.location = removeIndent(goTo);
});
Expand Down