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

Add GitHub account SSH key checking #153

Merged
merged 6 commits into from
May 11, 2022

Conversation

BobyMCbobs
Copy link
Member

Fixes #134

Copy link
Contributor

@zachmandeville zachmandeville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks great! I only added some style/linting suggestions to take as you will!

apps/client/resources/public/stylesheets/main.css Outdated Show resolved Hide resolved
@@ -24,7 +24,7 @@
[:header#top
[:h1 [:a.home {:href "/"} "sharing.io"]]
[:nav
(when permitted-member
(when (and permitted-member (not (empty? (:ssh-keys user))))(not= (:ssh-keys user) nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In clojure, if you call empty? on a string, it will return true if string == "" or string == nil.
So this conditional could be simplified to:
(when (and permitted-member (not (empty? (:ssh-keys user)))))

However, there's an option to simplify it further using a clojure idiom. Instead o calling (not (empty? val)) you can just say (seq val), as it will return nil if the value is "" or nil, and nil is a falsy value for the purpose of this conditional statement.

In that case, the code could be reduced to:

(when (and permitted-member (seq (:ssh-keys user))) 
...do-stuff)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! The (not= (:ssh-keys user) nil) might've been from when I was testing around things.

Testing it with (seq ...) works very well! Geez, that's so simple.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in c18eedb

@BobyMCbobs BobyMCbobs merged commit 9f0a748 into master May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add requirement for SSH keys on GitHub account before instance creation
2 participants