Skip to content

Conversation

rajvi-patel-22
Copy link
Member

@rajvi-patel-22 rajvi-patel-22 commented Mar 25, 2025

Guidelines for Pull Requests

If you haven't yet read our code review guidelines, please do so, You can find them here.

Please confirm the following by adding an x for each item (turn [ ] into [x]).

  • I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
  • I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
  • I do not have any sysout statements in my code or commented out code that isn’t needed anymore
  • I am not reformatting any files in the wrong format or without cause.
  • I am not changing file encoding or line endings to something else than UTF-8, LF
  • My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
  • I have added Javadoc/documentation where appropriate
  • I have added test cases where appropriate
  • I have explained any part of my code/implementation decisions that is not be self-explanatory

Please provide a brief description of your ticket

Users should set up their own connection with Conceptpower by entering their username and password and during concept resolution, their own account would be used.

https://diging.atlassian.net/browse/VOGRE-37

Are there any other pull requests that this one depends on?

This PR depends on #36

Anything else the reviewer needs to know?

... describe here ...

@diging-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@rajvi-patel-22 rajvi-patel-22 marked this pull request as ready for review April 17, 2025 15:45
concept_type,
equal_to=equal_uri)
except ConceptPowerCredentialsMissingException as e:
raise e
Copy link
Member

Choose a reason for hiding this comment

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

since this exception is already thrown I don't think you need to rethrow it?

account.save()
messages.success(request, "Password updated successfully!")
except ConceptpowerAccount.DoesNotExist:
messages.error(request, "No ConceptPower account found.")
Copy link
Member

Choose a reason for hiding this comment

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

conceptpower is spelled "Conceptpower"

ConceptpowerAccount.objects.filter(user=request.user).delete()
except Exception as e:
print(f"Error disconnecting Conceptpower account: {e}")

Copy link
Member

Choose a reason for hiding this comment

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

the user should see some message saying that either the account was disconnected successfully or that it didn't work.

@jdamerow jdamerow closed this Apr 25, 2025
@rajvi-patel-22 rajvi-patel-22 reopened this May 7, 2025
from external_accounts.models import ConceptpowerAccount


class ConceptPowerCredentialsMissingException(Exception):
Copy link
Member

Choose a reason for hiding this comment

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

Conceptpower is misspelled (lowercase 'p')

return concept_entries[0] if concept_entries else {}

def create(self, user, password, label, pos, conceptlist, description,
def create(self, user, label, pos, conceptlist, description,
Copy link
Member

Choose a reason for hiding this comment

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

just as important as throwing an exception when conceptpower credentials are missing is to throw one when the authentication is incorrect. right now it looks like it would just show a generic 'something went wrong' message to the user.

@jdamerow jdamerow closed this May 13, 2025
@jdamerow
Copy link
Member

jdamerow commented Jun 3, 2025

Resolve conflicts please

@jdamerow jdamerow closed this Jun 3, 2025
@rajvi-patel-22 rajvi-patel-22 reopened this Jun 3, 2025
"""Get or create a Fernet instance with a key"""
if not self._encryption_key:
self._encryption_key = Fernet.generate_key().decode()
self.save(update_fields=['_encryption_key'])
Copy link
Member

Choose a reason for hiding this comment

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

does this mean that the key to decrypt a password is stored in the db along with the password? that does not seem like the best approach. if someone gets access to the database, then they have all they need. might as well not encrypt the password at all. a better approach is probably to store the key as a setting. at least it's separate from the database.

@jdamerow jdamerow closed this Jun 6, 2025
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.

3 participants