Skip to content

Implement Member SSO (extracted from #617)#637

Open
krestenlaust wants to merge 1 commit into
nextfrom
feat/member-sso
Open

Implement Member SSO (extracted from #617)#637
krestenlaust wants to merge 1 commit into
nextfrom
feat/member-sso

Conversation

@krestenlaust
Copy link
Copy Markdown
Member

@krestenlaust krestenlaust commented Apr 3, 2026

All changes made in #617 that are strictly related to login (no OIDC)

This adds a login system for members which can be used to authenticate members outside trusted network or in public settings,

Adds /ffo/login-endpoint

All changes made in #617 that are strictly related to login (no OIDC)
@krestenlaust krestenlaust requested a review from ThomasBow April 3, 2026 22:31
@krestenlaust krestenlaust marked this pull request as ready for review April 3, 2026 22:31
@krestenlaust
Copy link
Copy Markdown
Member Author

gl hf

@krestenlaust krestenlaust linked an issue Apr 3, 2026 that may be closed by this pull request
Comment thread sso/views/login.py
def _send_otp_email(member: Member, otp: str) -> None:
full_code = f"F-{otp}"
print(f"Send F-code: {full_code}")
send_fcode_mail(member, full_code, f"hffps://{otp}", "linky")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hffps? Hyper F-klub F-code (p)For Stregsystemet?

@Mast3rwaf1z
Copy link
Copy Markdown
Member

Mast3rwaf1z commented Apr 9, 2026

60 commits in #617? Damn, that one would take months to review xD

It looks nice though

@krestenlaust
Copy link
Copy Markdown
Member Author

60 commits in #617? Damn, that one would take months to review xD

It looks nice though

Ty, it should be manageable

Copy link
Copy Markdown
Member

@Mast3rwaf1z Mast3rwaf1z left a comment

Choose a reason for hiding this comment

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

Feature looks really nice, there's some general code quality things

I think the pages are very pretty - but i think you should spend some time to make it consistent with the rest of the stregsystem? maybe refactor some of the css into something more generic

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please put in a seperate commit ✨

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is too pretty for the stregsystem

{% block title %}Log ind{% endblock %}

{% block head %}
<style>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not strictly related to this pr, but i think it would be nice to have shared css?


<div class="stage-dots"><span class="active"></span><span></span></div>
<h1>Kære Fember</h1>
<p class="subtitle">Indtast din stregbruger for at fortsætte.</p>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is stregbruger the common name for a user for the users?

Comment thread sso/views/login.py
}

def get(self, request):
ctx = self._base_context(request)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i kinda hate the ctx pattern

Comment thread sso/auth_backends.py

return member.paired_user

def get_user(self, user_id):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what type is user_id? could be str, int, bytes or whatever?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

function can return None, and the return statement doesn't make it clear what it returns

I'm not too familiar with django but i feel like objects.get(pk=user_id) could return vector[User] or User

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

list*

Comment thread sso/models.py

class MemberOTPRequest(models.Model):
member = models.ForeignKey(Member, on_delete=models.CASCADE)
code = models.CharField(max_length=6)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

might we end up supporting configurable length later?

Comment thread sso/tests.py
fresh = MemberOTPRequest.objects.get(member=self.member, is_valid=True)
self.assertNotEqual(fresh.code, self.otp)

# def test_max_attempts_shows_resend_message(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any reason this is commented out? please write a todo or something

Comment thread stregsystem/templates/mail/send_otp.html
Comment thread stregsystem/mail.py
)


def send_fcode_mail(member, fcode, link, redirect_url):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

types

@krestenlaust
Copy link
Copy Markdown
Member Author

I will get it looked at 😎

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.

Member authentication using email proof

2 participants