Ankush Menat
374bba5979
perf: use client cache for metadata version
2025-01-14 13:28:42 +05:30
Ankush Menat
59309f8164
perf: do not validate user on session resume ( #29074 )
...
* fix: Consume sid from arguments
* perf: do not validate user on resume
Errr, why would we ever need to validate if user with active session is
"disabled"?
When active user is disabled, their sessions are wiped from cache and DB.
2025-01-07 12:52:23 +00:00
Ankush Menat
60a3c41c7a
perf: Avoid storing redundant information - last session update ( #28922 )
...
Session contains the same exact information, so why do we need this?
2024-12-26 12:38:14 +00:00
Ankush Menat
03036bfc91
perf: Use system settings for fetching expiry
...
It's just copy of the same data. IMO sys settings is always the "true"
source of truth.
2024-12-26 11:27:27 +05:30
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Shariq Ansari
bfb9d0beb8
fix: load apps_data in boot for desk
2024-09-05 19:20:52 +05:30
Akhil Narang
cd67eba32d
fix(sessions): pass force parameter to get_sessions_to_clear()
...
Not sure why this didn't get committed with the original PR: #27542
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-02 17:52:47 +05:30
Shariq Ansari
9133f2a9c5
fix: added apps data in boot
2024-08-30 15:42:58 +05:30
Akhil Narang
5570aa71be
fix(sessions): logout properly when user requests logout on password change
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-08-27 17:58:20 +05:30
Shariq Ansari
3f5d6d2c7f
feat: added default app selector in user doctype
2024-08-08 19:54:02 +05:30
Shariq Ansari
67eb28d836
fix: redirect to apps if multiple apps installed or redirect to apps portal
2024-08-08 18:29:16 +05:30
Ankush Menat
a234e79790
refactor: misc changes
...
- Move sys setting check to server side
- tomli import handling
2024-05-04 15:08:34 +05:30
Ankush Menat
7fe9cc4f09
perf: Don't update session in cache after every request ( #26308 )
...
It's just reading and writing same information except last_update inside
data which is never read back from this.
2024-05-04 06:10:38 +00:00
Rutwik Hiwalkar
a73e65581d
fix: disabled user login from login via link feature ( #26134 )
...
* fix(ui): button color for login via link template
- blue > black
* fix: restrict login via link for disabled users
* fix: validate user on session.resume
2024-04-24 15:49:17 +05:30
Ankush Menat
bef9bdc5ee
fix: log out reliability ( #25865 )
...
* fix: Avoid possible cache eviction issue
Clear cache after removing data from DB, so a concurrent request can't put stale data in cache.
* fix: explicitly login as guest after logging out
Avoids problem with some other code potentially re-adding current
session in cache or DB.
* test: avoid hard coded admin pw
* test: reset user after running tests
* fix: only login as guest if in request
Background jobs, some other user disabling someone else etc
2024-04-09 18:56:52 +05:30
Gursheen Anand
2c0498cbdd
fix: use boot to store announcement
2024-03-29 16:24:41 +05:30
Ankush Menat
7a854efc03
refactor: Use JSON for session data ( #25207 )
...
JSON is proper format compared to using safe_eval which is a hack to convert
string repr of dict object back into python object.
2024-03-04 06:47:48 +00:00
Ankush Menat
24499d93f8
fix: notify user that they were impersonated
2024-02-24 18:31:10 +05:30
Ankush Menat
be47ee0e31
fix: track all impersonated changes
2024-02-24 18:25:09 +05:30
Ankush Menat
c58ac809ac
fix: Flag impersonated sessions
2024-02-24 18:25:09 +05:30
Ankush Menat
de9ac89748
style: re-format with ruff
2024-02-05 18:53:33 +05:30
Ankush Menat
70a6a8334f
fix: set same cookie expiry as client side ( #24560 )
2024-01-29 05:52:40 +00:00
Ankush Menat
484049c5ae
fix: simultenous sessions ux ( #24387 )
...
* fix: set 2 as simultaneous_sessions by default
* fix: Correct offset for simultaneous_sessions
* refactor: use freeze_time instead of patching
* chore: misleading docstring
* test: set lower simultaneous_sessions for test
2024-01-16 13:36:05 +00:00
Hussain Nagaria
8d2137c265
docs: consistent doc strings
2023-12-18 18:27:39 +05:30
Ankush Menat
ad79c9d180
chore: remove broken call to geoip
...
This has never worked afaik
2023-07-01 20:07:05 +05:30
Ankush Menat
0e1236b6be
refactor: Simplify expiry queries.
...
Dont rely on mysql dateutils, simply compare dates with a cutoff.
2023-06-28 18:05:12 +05:30
Ankush Menat
d353662b53
fix: Session insert using system time
...
NOW() is server time not system time.
2023-06-28 17:47:22 +05:30
Ankush Menat
60efb7c2ff
fix: incorrect session expiry datediff
...
Datediff doesn't work like this in MYSQL, mysql just treats the
timestamp as flat timestamp.
2023-06-28 17:47:22 +05:30
Ankush Menat
7c4009fde9
refactor: use QB
2023-06-28 17:47:22 +05:30
Ankush Menat
564b960678
fix: correct last update value
...
`NOW()` evalautes to server's time we should use system time instead.
2023-06-28 17:47:22 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache ( #21282 )
2023-06-08 11:47:17 +05:30
Sagar Vora
4ea39d1a68
chore!: drop device support from session ( #18729 )
...
* chore!: drop device support from session
* chore: remove `session_expiry_mobile` field
* fix: remove extra `%s`
2022-12-05 16:37:32 +05:30
Ankush Menat
87092ec0b3
fix: don't attempt to delete session during read only session
2022-09-10 12:45:25 +05:30
Ankush Menat
1ec03dacff
feat(UX): Disable write actions in read-only Desk
...
I won't be covering each and every aspect of desk that shouldn't work in
read only mode. This just handles major interactions and assumes that
user will get a hint about why other things aren't working.
Changes:
- Add read only badge on navbar.
- Disable forms
- Disable new doc creation
2022-09-09 17:34:46 +05:30
Ankush Menat
5922c0ea35
fix: dont renew session during read only mode
2022-09-08 18:22:08 +05:30
hrwx
b01929405d
refactor: translatable doctypes
2022-08-05 21:38:10 +01:00
Ankush Menat
1f9a6b010a
perf: add __slots__ to most used classes ( #17421 )
...
Added slots for these classes:
- Session - Created on EACH request
- LoginManager - Created on each request
- Monitor - Created on each request if monitor is enabled (usually in
prod setup)
2022-07-07 11:15:50 +05:30
Gavin D'souza
3871fe6cd0
perf: App Page
...
Reduced time taken for get_context to execute from 0.035s to 0.02s (75%
reduction)
2022-06-13 18:39:56 +05:30
Himanshu
70409a3c7b
fix: set translated text to link field ( #15451 )
...
- Fixes [Issue/15324](https://github.com/frappe/frappe/issues/15324 )
- When selecting a value for Link Field, the English text was set as link field value.
- This PR aims to fix it by setting the translated text as link field value on selection.
Todo:
- [x] Show translated text in the select dropdown
- [x] Set translated value to Link field on select
- [x] Show original value when link field is in focus
- [x] Add option to toggle this behaviour
### Behaviour
- Link field loses focus: show the translated name.
- Link field is focused
- If old value is present
- If options **are** one of [Role, DocType]: show the translated name
- Else: show the name (untranslated) to enable search in untranslated values
- Else: show what the user typed (untranslated) to enable search in untranslated values
- Value is selected: link field loses focus
## Demo
### Link to UOM in a custom Item DocType
The UOM names are in english, so the search needs to happen in english. When possible, the translation is displayed.
#### Before
https://user-images.githubusercontent.com/14891507/156415248-e5e80d05-53dc-4ca8-89c7-998986ff6e99.mov
#### After
https://user-images.githubusercontent.com/14891507/156410386-a874430c-f340-43ed-9c3a-92e8d4d50fc9.mov
### Link to DocType in Customize Form
The DocType names get translated before being searched. This is a preexisting hack in the framework for DocType and Role. In this case, we can search in the translations.
#### Before
https://user-images.githubusercontent.com/14891507/156414648-8e505f8c-9dee-4358-8182-3b358c28bb62.mov
#### After
https://user-images.githubusercontent.com/14891507/156411881-c4ca22e1-1397-4e13-9768-5e16b72f8d6d.mov
https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/customize-form/edit?wiki_page_patch=fdafee2715
2022-05-16 13:21:42 +00:00
phot0n
33b49b4d46
refactor(minor): remove is_first_startup from System Settings
2022-05-04 10:43:59 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black ( #16453 )
...
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Abhishek Saxena
5c8856d66e
refactor: db.sql calls to frappe.qb ( #16107 )
...
# Changes
- Introduces `subqry` class to use in where clause when there is a non-column condition. eg.
> .where(subqry(no_of_roles) == 0)
- Convert SQL queries to frappe.qb
# Testing
Functions with query refactors
- frappe.boot.get_user_pages_or_reports() -> Same output of `get_bootinfo()` as develop
- frappe.boot.get_unseen_notes() -> Forms the same query as develop
```sql
SELECT `name`,`title`,`content`,`notify_on_every_login`
FROM `tabNote` WHERE `notify_on_every_login`=1
AND `expire_notification_on`>'2022-03-30 01:10:53.393874'
AND (SELECT `nsb`.`user` FROM `tabNote Seen By` `nsb` WHERE `nsb`.`parent`=`tabNote`.`name`) NOT IN ('Administrator')
```
- frappe.installer._delete_doctypes() -> installed and uninsalled a dummy app to drop tables
### Not tested
- frappe.make_property_setter()
- frappe.realtime.get_pending_tasks_for_doc() [whitelist method]
- frappe.sessions.Session.start()
- frappe.twofactor.cache_2fa_data()
2022-04-12 05:07:25 +00:00
barredterra
b1383df15a
refactor: use is None instead of == None
2022-01-17 10:37:51 +01:00
Suraj Shetty
b6cb0fc1e7
fix: Pass SQL string of lastupdate instead of normal string
...
- Normal string of pypika field has additional quotes
which creates a invalid query
- `get_sql` returns column name without additional quotes
2022-01-17 10:01:29 +05:30
Aradhya
1ff3a0d517
fix: fixed sider issues
2021-12-30 19:29:02 +05:30
Aradhya
a109034ea5
fix: frappe.db.escape in query generated by frappe.qb
2021-12-30 19:15:11 +05:30
Aradhya
08d94d991f
refactor: changed query in sessions
2021-11-23 15:49:16 +05:30
Aradhya
59f54aa60c
refactor: changed default_ordering to keep_default_ordering
2021-11-23 15:26:15 +05:30
Aradhya
50db6d5dd4
refactor: refactored query in sessions
2021-11-23 14:47:03 +05:30
Aradhya
9ccf467acb
fix: fixed no order arg in converted queries
2021-11-23 13:30:42 +05:30