Title: Building Custom Comparator for SQLAlchemy for the password property · Issue #51 · anomaly/lab-python-server · GitHub
Open Graph Title: Building Custom Comparator for SQLAlchemy for the password property · Issue #51 · anomaly/lab-python-server
X Title: Building Custom Comparator for SQLAlchemy for the password property · Issue #51 · anomaly/lab-python-server
Description: Extending from the pattern that allows developers to simply set the password property and a setter hashes it on the way in. The User model class has substantial documentation on this. The general approach is to declare the property as: _...
Open Graph Description: Extending from the pattern that allows developers to simply set the password property and a setter hashes it on the way in. The User model class has substantial documentation on this. The general a...
X Description: Extending from the pattern that allows developers to simply set the password property and a setter hashes it on the way in. The User model class has substantial documentation on this. The general a...
Opengraph URL: https://github.com/anomaly/lab-python-server/issues/51
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Building Custom Comparator for SQLAlchemy for the password property","articleBody":"Extending from the pattern that allows developers to simply set the `password` property and a setter hashes it on the way in. The `User` model class has substantial documentation on this. The general approach is to declare the property as:\r\n\r\n```python\r\n_password = Column(\"password\",\r\n String,\r\n nullable=True)\r\n```\r\n\r\nfollowed by exposing the `password` property as:\r\n\r\n```python\r\n@property\r\ndef password(self):\r\n return self._password\r\n```\r\n\r\nand finally overriding the setter to `hash` the password on the way in:\r\n```python\r\n@password.setter\r\ndef password(self, password):\r\n self._password = hash_password(password)\r\n```\r\n\r\nThe [Building Custom Comparator](https://docs.sqlalchemy.org/en/14/orm/extensions/hybrid.html#building-custom-comparators) guide outlines how we can override the comparator of `hybrid_property` in `SQLAlchemy`, if we adopt this paradigm then we can achieve comparing password as:\r\n\r\n```python\r\nuser.password == password\r\n```\r\n\r\nas opposed using `check_password` method","author":{"url":"https://github.com/devraj","@type":"Person","name":"devraj"},"datePublished":"2022-10-21T04:05:14Z","url":"https://github.com/anomaly/lab-python-server/issues/51"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0b04991c-9b2f-6748-d1d1-f8d32b088f06 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D808:36C2D7:3D7AC7:55960C:6B0479F1 |
| html-safe-nonce | 2400a74f1a5e735c62ff93b8e00561ea5857966fe5f8cddfc0b956905c9b42d1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODA4OjM2QzJENzozRDdBQzc6NTU5NjBDOjZCMDQ3OUYxIiwidmlzaXRvcl9pZCI6IjU0MDIwMzE3ODAxODAyOTQxMjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 50ea62bf4b2e95dfa0c33671bec501b06cdb1d3ed25201ae7397d9d951f8c821 |
| hovercard-subject-tag | issue:1417689985 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/anomaly/lab-python-server/51/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2020968a0568f513fe4c8b64ea2edb68fa8ba75b0e694f9722749f73125a28a3/anomaly/lab-python-server/issues/51 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2020968a0568f513fe4c8b64ea2edb68fa8ba75b0e694f9722749f73125a28a3/anomaly/lab-python-server/issues/51 |
| og:image:alt | Extending from the pattern that allows developers to simply set the password property and a setter hashes it on the way in. The User model class has substantial documentation on this. The general a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | devraj |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c099f1b85def81ca352464c276510dfef32deaf3c305404e65b8d270284a58b |
| turbo-cache-control | no-preview |
| go-import | github.com/anomaly/lab-python-server git https://github.com/anomaly/lab-python-server.git |
| octolytics-dimension-user_id | 3654837 |
| octolytics-dimension-user_login | anomaly |
| octolytics-dimension-repository_id | 491764445 |
| octolytics-dimension-repository_nwo | anomaly/lab-python-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 491764445 |
| octolytics-dimension-repository_network_root_nwo | anomaly/lab-python-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cf73f57448d52b3a7b619195e182b33d3b3454ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width