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

Additional admin functions #50

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Conversation

jgknight
Copy link
Contributor

@jgknight jgknight commented Jul 7, 2024

Summary

This PR finishes the previously stubbed out admin functionality for requesting and setting email address, confirmation status, and registration preference/status.

It also adds a check that was missing to the formatting screenname validation that the sn doesn't end in a space.

Email Address

  • User can now set and update their email address using the AIM client
  • Performs validation that it meets basic format user@host
  • Performs validation that it is <= 320 characters
  • Note that any waiting periods or confirmations etc are not required at this time

Confirmation Status

  • User confirmation status is now reflected in the UserInfoFlags TLV. This can be seen when hovering mouse cursor over the user in your buddy list
  • User can confirm their account if they have an email address set
  • Note that any waiting periods or confirmations etc are not required at this time

Registration Preference/Status

  • User can update their privacy preference in the AIM client and it is stored/reflected back to them

Other changes

  • Added database migrations to add new columns for the email, confirmation, and reg pref data
  • Added a clientInfoFlags member to the Session struct and added setters/getters so these flags can be updated more centrally. Note this also includes moving the away/unavailable flag setting logic to avoid a deadlock
  • Updated unit tests

Future changes
Just wanted to mention that I'm intentionally not doing in this PR:

  • Mgmt api - I need to figure out a good spot for the username and email address validation logic so that we can apply the same logic to new accounts via mgmt api, new accounts via disable_auth, and for updates from the AIM client

Testing Done

Logging in as a brand new account, the account shows up as 'Unconfirmed Internet' in the buddy list
image

Attempting to format the screenname with one ending in a space results in an error
image

Attempting to confirm the account (My AIM > Edit Options > Confirm Account) without an email address set results in an error
image

Opening the update email address window, it starts out reporting the user has no email set

image

Attempting to enter an invalid email format results in an error
image

Setting the email to TestUser10@aol.com results in a success message. Note that as of this writing, the email change isn't actually pending and the user doesn't need to wait 72 hours. The email is immediately updated in the database, which can be seen if you open the update email address window again

image image

Now with an email set, the account can be confirmed. Attempting to reconfirm the account will tell the user it's already confirmed
image
image

Confirming the account sends a broadcast to all buddies with the updated userinfo tlv and now hovering over the name no longer shows the unconfirmed status
image

Resigning into AIM, the user continues to report as just 'Internet' not 'Unconfirmed Internet'

I also tested that setting Away/returning still works as I moved the logic for setting those flags.

Going to Preferences > Privacy, the toggle at the bottom can now be adjusted and saved
image

For the database migration I started with a database from retro-aim-server release version 0.8.0. Running the newer binary from my local build resulted in the database table having additional columns created and email address could be saved.

All unit tests pass.

Copy link
Owner

@mk6i mk6i left a comment

Choose a reason for hiding this comment

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

thanks for the PR, just a few small things

foodgroup/admin.go Show resolved Hide resolved
foodgroup/admin.go Outdated Show resolved Hide resolved
foodgroup/auth.go Outdated Show resolved Hide resolved
state/migrations/0005_user_settings.down.sql Outdated Show resolved Hide resolved
state/session.go Show resolved Hide resolved
@jgknight jgknight force-pushed the additional-admin-functions branch from 536e922 to 605b142 Compare July 9, 2024 01:52
@jgknight jgknight requested a review from mk6i July 9, 2024 02:02
@jgknight
Copy link
Contributor Author

jgknight commented Jul 9, 2024

I've updated the error cases to send with the correct snac. I also noticed that pidgin/libpurple checks for the error TLV + a not-null URL TLV so that's why I'm sending it.

 * setting email address
 * setting reg status preference
 * confirming account
 * set userinfo flags for unconfirmed account
 * database migration for new tables
 * added consts for userinfo flags
@jgknight jgknight force-pushed the additional-admin-functions branch from 605b142 to acc373a Compare July 9, 2024 02:10
@mk6i mk6i merged commit f5edf66 into mk6i:main Jul 9, 2024
1 check passed
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.

2 participants