-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MLPAB-1746: Create and show Member when accepting Organisation invite (…
- Loading branch information
Showing
37 changed files
with
2,117 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,10 +36,11 @@ var ( | |
) | ||
|
||
type sessionData struct { | ||
user string | ||
nonce string | ||
identity bool | ||
sub string | ||
user string | ||
nonce string | ||
identity bool | ||
sub string | ||
emailOverride string | ||
} | ||
|
||
type OpenIdConfig struct { | ||
|
@@ -138,9 +139,15 @@ func authorize() http.HandlerFunc { | |
<style>body { font-family: sans-serif; font-size: 21px; margin: 2rem; } label { padding: .5rem 0; display: block; } button { font-family: inherit; font-size: 21px; padding: .3rem .5rem; margin-top: 1rem; display: block; }</style> | ||
<h1>Mock GOV.UK One Login</h1> | ||
<form method="post"> | ||
<p>Sign in using a OneLogin sub (to ignore, leave empty)</p> | ||
<label for="sub">OneLogin sub</label> | ||
<input type="text" name="sub" id=f-sub /> | ||
<p>Set email in OneLogin UserInfo (leave empty to set as test email address)</p> | ||
<label for="email">Email</label> | ||
<input type="text" name="email" id=f-email /> | ||
<button type="submit">Sign in</button> | ||
</form>`) | ||
return | ||
|
@@ -167,10 +174,11 @@ func authorize() http.HandlerFunc { | |
q.Set("state", r.FormValue("state")) | ||
|
||
sessions[code] = sessionData{ | ||
nonce: r.FormValue("nonce"), | ||
user: r.FormValue("user"), | ||
identity: wantsIdentity, | ||
sub: r.FormValue("sub"), | ||
nonce: r.FormValue("nonce"), | ||
user: r.FormValue("user"), | ||
identity: wantsIdentity, | ||
sub: r.FormValue("sub"), | ||
emailOverride: r.FormValue("email"), | ||
} | ||
|
||
u.RawQuery = q.Encode() | ||
|
@@ -190,9 +198,14 @@ func userInfo(privateKey *ecdsa.PrivateKey) http.HandlerFunc { | |
sub = token.sub | ||
} | ||
|
||
email := "[email protected]" | ||
if token.emailOverride != "" { | ||
email = token.emailOverride | ||
} | ||
|
||
userInfo := UserInfoResponse{ | ||
Sub: sub, | ||
Email: "[email protected]", | ||
Email: email, | ||
EmailVerified: true, | ||
Phone: "01406946277", | ||
PhoneVerified: true, | ||
|
@@ -226,7 +239,7 @@ func userInfo(privateKey *ecdsa.PrivateKey) http.HandlerFunc { | |
}).SignedString(privateKey) | ||
} | ||
|
||
log.Printf("Logging in with sub %s", sub) | ||
log.Printf("Logging in with sub %s and email %s", sub, email) | ||
json.NewEncoder(w).Encode(userInfo) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
const { TestEmail } = require("../../support/e2e"); | ||
|
||
describe('Organisation details', () => { | ||
beforeEach(() => { | ||
cy.visit('/fixtures/supporter?organisation=1&redirect=/manage-organisation/manage-team-members&inviteMembers=1'); | ||
}); | ||
it('shows invited and joined members', () => { | ||
cy.visit('/fixtures/supporter?organisation=1&redirect=/manage-organisation/manage-team-members&invitedMembers=2&members=2'); | ||
|
||
it('shows invited members', () => { | ||
cy.checkA11yApp(); | ||
cy.contains("a", "Manage team members").click() | ||
|
||
cy.contains("Invited team members") | ||
|
||
cy.contains("td", "kamalsingh@example.org").parent().within(() => { | ||
cy.contains("td", "kamal-singh@example.org").parent().within(() => { | ||
cy.contains("Kamal Singh") | ||
cy.contains("Invite pending") | ||
cy.contains("a", "Resend invite") | ||
}) | ||
|
||
cy.contains("td", "jo_alessi@example.org").parent().within(() => { | ||
cy.contains("td", "jo-alessi@example.org").parent().within(() => { | ||
cy.contains("Jo Alessi") | ||
cy.contains("Invite pending") | ||
cy.contains("a", "Resend invite") | ||
}) | ||
|
||
cy.contains("Team members") | ||
|
||
cy.contains("td", "[email protected]").parent().within(() => { | ||
cy.contains("Alice Moxom") | ||
cy.contains("Admin") | ||
cy.contains("Active") | ||
}) | ||
|
||
cy.contains("td", "[email protected]").parent().within(() => { | ||
cy.contains("Leon Vynehall") | ||
cy.contains("Admin") | ||
cy.contains("Active") | ||
}) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.