Skip to content

Commit

Permalink
fix(GRA-1387): remove join by sso/basic auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceix committed Mar 14, 2023
1 parent 22ba850 commit ec8630d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 103 deletions.
8 changes: 0 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,14 @@ require (
)

require (
cloud.google.com/go/compute v1.14.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/bep/debounce v1.2.1 // indirect
github.com/coreos/go-oidc/v3 v3.5.0 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.17+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
Expand All @@ -60,7 +54,6 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-github/v30 v30.1.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
Expand Down Expand Up @@ -94,7 +87,6 @@ require (
github.com/rqlite/gorqlite v0.0.0-20210514125552-08ff1e76b22f // indirect
github.com/samber/lo v1.27.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
Expand Down
46 changes: 1 addition & 45 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions gui/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gui/frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f9fab56505f0bd193d1cb41789de0ea3
ce83f2292be5a3be258bc8da96ba9236
13 changes: 1 addition & 12 deletions gui/frontend/src/pages/LoginOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ function LoginOption() {
to={AppRoutes.TOKEN_LOGIN_ROUTE}
data-testid="login-by-token-btn"
>
By Token/Enrollment Key
</Button>
</Grid>

<Grid item xs={12}>
<Button
variant="contained"
component={Link}
to={AppRoutes.USERNAME_LOGIN_ROUTE}
data-testid="login-by-cred-btn"
>
Username/Password/SSO
By Enrollment Key
</Button>
</Grid>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion gui/frontend/src/pages/Networks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Networks() {
component={Link}
size="medium"
style={{ marginLeft: "2rem" }}
to={AppRoutes.LOGIN_OPTIONS_ROUTE}
to={AppRoutes.TOKEN_LOGIN_ROUTE}
data-testid="add-network-btn"
>
Add New
Expand Down
27 changes: 2 additions & 25 deletions gui/frontend/src/pages/TokenLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function TokenLogin() {
const [enrollmentKey, setEnrollmentKey] = useState("");
const [isConnecting, setIsConnecting] = useState(false);
const [type, setType] = useState<"access-key" | "enrollment-key">(
"access-key"
"enrollment-key"
);
const navigate = useNavigate();
const { networksDispatch } = useNetworksContext();
Expand Down Expand Up @@ -102,13 +102,8 @@ function TokenLogin() {
<FormLabel>Token type</FormLabel>
<RadioGroup
onChange={(ev, type) => setType(type as any)}
defaultValue="access-key"
defaultValue="enrollment-key"
>
<FormControlLabel
label="Access Key"
value="access-key"
control={<Radio />}
/>
<FormControlLabel
value="enrollment-key"
control={<Radio />}
Expand All @@ -118,24 +113,6 @@ function TokenLogin() {
</FormControl>
</Grid>

{type === "access-key" && (
<Grid item xs={12}>
<TextField
key="token-inp"
label="Token"
placeholder="Enter network token"
value={token}
onChange={(e) => setToken(e.target.value)}
error={!isFormValid}
helperText={isFormValid ? "" : "Token cannot be empty"}
inputProps={{ "data-testid": "token-inp" }}
/>
<br />
<Typography variant="caption">
*Token can be acquired from Netmaker server
</Typography>
</Grid>
)}
{type === "enrollment-key" && (
<Grid item xs={12}>
<TextField
Expand Down
7 changes: 2 additions & 5 deletions gui/frontend/tests/pages/LoginOptions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ describe("LoginOptionsPage", () => {
});
});

it("provides login/join options", () => {
it("provides login options", () => {
act(() => {
expect(screen.getByTestId("login-by-token-btn")).toBeInTheDocument()
expect(screen.getByTestId("login-by-token-btn")).toHaveTextContent('By Token/Enrollment Key')

expect(screen.getByTestId("login-by-cred-btn")).toBeInTheDocument()
expect(screen.getByTestId("login-by-cred-btn")).toHaveTextContent('Username/Password/SSO')
expect(screen.getByTestId("login-by-token-btn")).toHaveTextContent('By Enrollment Key')
});
});

Expand Down
8 changes: 4 additions & 4 deletions gui/frontend/tests/pages/TokenLogin.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ describe("TokenLoginPage", () => {

it("provides provides an input to enter token", () => {
act(() => {
expect(screen.getByTestId("token-inp")).toBeInTheDocument()
expect(screen.getByTestId("enrollment-key-inp")).toBeInTheDocument()
});
});

it("validates token", () => {
act(() => {
fireEvent.click(screen.getByTestId("connect-btn"))
});
expect(screen.getByText('Token cannot be empty')).toBeInTheDocument()
expect(screen.getByText('Enrollment key cannot be empty')).toBeInTheDocument()

act(() => {
fireEvent.change(screen.getByTestId("token-inp"), { target: { value: 'random-token' } })
fireEvent.change(screen.getByTestId("enrollment-key-inp"), { target: { value: 'random-token' } })
fireEvent.click(screen.getByTestId("connect-btn"))
});
expect(screen.queryByText('Token cannot be empty')).toBeNull()
expect(screen.queryByText('Enrollment key cannot be empty')).toBeNull()
});

});

0 comments on commit ec8630d

Please sign in to comment.