Commit graph

117 commits

Author SHA1 Message Date
xuyuwtu
4671a6d7f7 resolve some warnings 2026-01-29 15:16:53 +08:00
xuyuwtu
75c8a8ced4 Use better code 2026-01-29 13:50:09 +08:00
Cai
9eb49b0447
sync 2026-01-28 14:13:30 +08:00
Sakura Akeno Isayeki
9c473e35a6
refactor(db/pgsql): Revert SQL queries, lower column casing for PGSQL
Reverts SQL query identifier escaping to simplify queries and improves overall readability by using lowercase column names.

Enhances maintainability and alignment with database conventions by adopting a uniform casing scheme across all SQL operations.

Removes unnecessary complexity in query construction, streamlining the database operations performed within the application.
2025-05-03 19:21:10 +02:00
Sakura Akeno Isayeki
de602a91d4
fix(db): Correct casing and escaping in DB queries
Updates the database queries to handle casing inconsistencies
and improves SQL query parameter escaping for better
security and compatibility.

Refactors group existence checks for simplicity, enhancing
readability and maintainability.

Addresses issues related to unique constraints in user
registration by improving error handling for duplicate
usernames.
2025-04-29 01:38:32 +02:00
Sakura Akeno Isayeki
2d839e3609
fix(db/postgres): Resolve SQL identifier casing issues
Improves SQL query execution by ensuring proper casing for identifiers across various database types, particularly for Postgres.

Enhances security and compatibility by using an identifier escaping method, preventing potential errors due to case sensitivity in SQL queries.

Addresses potential issues with existing queries for better reliability and consistency.
2025-04-29 00:47:19 +02:00
Sakura Akeno Isayeki
084411f847
refactor(db): Update SqlQueryBuilder references + Various refactors
Consolidates the creation of SQL query builders across multiple classes to ensure a unified approach for database operations.

Replaces manual type checks and specific query creators with a generic method for better maintainability and to prevent errors.

Improves code readability and reduces duplication, facilitating easier updates in the future.
2025-04-28 15:51:26 +02:00
Sakura Akeno Isayeki
8a75b1fdc5
refactor(db): Move DbQueryBuilders to separate namespace
Removes obsolete query builder interface and implementations.

Introduces a new namespace for query-related classes to enhance organization.

Updates various database managers to use the new query utilities, promoting code reuse and maintainability.

Enhances query functionality, ensuring better consistency across the codebase.
2025-04-28 14:06:02 +02:00
AkjaHAsLk1IALk0MasH
a6666ff21a Updated the message 2023-06-10 13:59:38 +07:00
AkjaHAsLk1IALk0MasH
1e037748c1 Updated the UserManager.SetUserGroup.
Added an exception `UserGroupUpdateLockedException`, which appears when a hook locks a group change.
Added an overload for `UserManager.SetUserGroup`, with the `TSPlayer` parameter (author)
2023-05-14 12:13:56 +07:00
AkjaHAsLk1IALk0MasH
22d8575e01 Corrected the UserAccountNotExistException documentation. 2023-05-14 12:04:17 +07:00
Janet Blackquill
f63b26ac76 Some i18nifiying 2022-10-21 16:12:04 -04:00
Lucas Nicodemus
9416e8f1e2 Remove DIY password hashing crypto
The old system for hashing passwords and permitting users to select
their algorithm has been deprecated and phased out since 2015. This
removes the remaining functions for hashing passwords to clear the way
for .NET5/6 and for OTAPI 3.

In 211b70ca37, I allowed blank passwords
to upgrade to bcrypt hashes. However, the minimum password length has
been 4 historically for a long time. So I don't actually assume a lot of
users have blank passwords, so I think there are very few, if any of the
old hashes laying around.

So therefore, I think this is pretty much safe to merge.
2021-11-22 10:26:57 -08:00
Lucas Nicodemus
211b70ca37 Upgrade blank passwords to bcrypt hashes
Previously, blank passwords were not upgraded to bcrypt hashes. This is
annoying and problematic because it makes it difficult to remove the old
password hashing system because those passwords might still be checked
against non-bcrypt hashes.
2021-11-21 14:44:53 -08:00
Killia0
154bee58f1 Typo fixes on comments/strings
My first PR contribution to TShock is spellcheck huh, frankly I don't know why but hey I could spare the time for this and caught some stuff.
2021-07-16 14:53:37 -04:00
Chris
9423febd0a Refactor for new configuration 2020-12-03 17:43:10 +10:30
Lucas Nicodemus
70dd72443d Update copyright to 2019 again
Fixes #1658, most likely.
2019-03-29 17:16:37 -07:00
Enerdy
f5ccf925bd Logout players when their user account is removed 2018-10-15 14:33:32 +01:00
Ruby Rose
4df8a6f38f add another case to the exception message regex 2018-09-23 14:29:59 +03:00
Lucas Nicodemus
569b350cea Update to Pryaxis, 2018 part 2
If there's one thing I learned in this exercise, it's that letting
people add random python scripts to the repo like gpltext.py that
promise to be easier than find and replace is a bad idea.
2018-01-01 02:20:56 -07:00
Edgar Luque
6589531868 Renamed TShockAPI.DB 'User' to 'UserAccount' 2017-12-08 01:38:15 +01:00
Ruby Rose
02be378a2e change doc of Equals 2017-07-17 06:34:30 +03:00
Ruby Rose
5e1be5b19b Fix formatting below IEquatable block 2017-07-17 06:34:30 +03:00
Ruby Rose
c8e31231ba override ToString of user 2017-07-17 06:34:30 +03:00
Ruby Rose
4216501c45 Make User implement IEquatable for more consistent comparisons 2017-07-17 06:34:30 +03:00
White
c4a3a9fb67 Updated Copyright for 2017 2017-03-13 12:17:16 +10:30
Lucas Nicodemus
678f6c7cf8
Update to Mintaka (thanks @enerdy) 2016-12-06 17:36:44 -07:00
Lucas Nicodemus
b15dfbc1ec
Don't catch the exceptions we throw in SetUserGroup
For some reason, we were catching our own exceptions and then
throwing UesrManagerExceptions despite the fact that we explicitly
threw more specific exceptions.

Fixes #1315.
2016-10-23 05:49:16 -06:00
Adilson Carvalho
49b4effe74 Changed year to 2016 on all GPL headers 2016-10-16 17:06:02 -02:00
Enerdy
0a51f208f5 Fixed /user group and any other method using TShock.Users.SetUserGroup() 2015-07-06 01:32:08 +01:00
White
da62f23c50 Fixed a typo that would have caused issues 2015-05-28 17:06:58 +09:30
White
4bc4b2a6eb Fixed another bug with the BCrypt implementation 2015-05-28 16:44:34 +09:30
White
ec178f0c4a Fixed the bug where updating the config WorkFactor would mean that users could not log into their accounts once their passwords were updated to the new WorkFactor 2015-05-28 11:51:29 +09:30
White
e33b6ebebc Now targets NET 4.5, so the solution actually compiles.
Fixed an issue where /user password sets a blank string in the database
Fixed an issue where /password <old> <new> wouldn't update the user's password
2015-05-27 18:29:29 +09:30
White
44ad0c68b8 Change TSPlayer.UserID to TSPlayer.User.ID, as well as refactoring some of UserManager.cs. Solves #916 2015-05-01 11:18:37 +09:30
Lucas Nicodemus
fcda79ea4c Fix blank password logins further
How this worked prior to BCrypt is beyond me
2015-04-30 15:56:29 -06:00
Lucas Nicodemus
ddd89043c9 Fix blank password legacy behavior in TShock.
Fixes #907
2015-04-30 15:52:08 -06:00
White
dd7ad78d3f Adds a User object to TSPlayer 2015-04-29 17:24:20 +09:30
White
c55893fe88 Adds a fuzzy name search for obtaining users. This means plugins no longer have to retrieve all Users with TShock.Users.GetUsers() to do a fuzzy name search 2015-04-21 16:46:24 +09:30
Lucas Nicodemus
342921b3ed Document Utils.cs & UserManager.cs
Deprecated Utils.Random()
2015-04-19 21:14:15 -06:00
Lucas Nicodemus
85661f3485 Move to "protected" only (thanks @MarioE!) 2015-04-14 08:16:11 -06:00
Lucas Nicodemus
c5034a23ad Turns out that OmniServer doesn't refactor after all, who knew? Fix build. 2015-04-13 23:31:38 -06:00
Lucas Nicodemus
b34c00107c "Brace" for impact with these Important changes
Apparently the convention is UpperCamel for private functions too.
Fixed a stray brace that caused people to brace for a sudden evisceration of limbs.
Use Int32.Parse instead of Convert.ToInt32, because Microsoft exposes public
APIs they say not to use. 👏
2015-04-13 23:24:37 -06:00
Lucas Nicodemus
136064f4b2 Fix formatting of old aglo block
Also spelled algorithms correctly
2015-04-13 14:57:58 -06:00
Lucas Nicodemus
493dc0c069 Change braces to use VS style 2015-04-13 14:49:04 -06:00
Lucas Nicodemus
12f893e0cb Require minimum password length of 4, and trim new passwords for whitespace.
Fixes problems reported by @MarioE and @Simon311:
- Users can no longer register with whitespace for a password.
- Users can no longer register with 4 whitespaces for a password.
2015-04-13 14:26:12 -06:00
Lucas Nicodemus
845c8c4b3d Change access modifiers to 'protected internal'
(this is what I meant anyway by internal, didn't realize internal
allowed any access in the assembly)
2015-04-13 13:06:49 -06:00
Lucas Nicodemus
1f690440d0 Change errors in BCrypt to be more clear for users to fix
Change doc verbiage to refer to what these actually do
2015-04-13 12:46:10 -06:00
Lucas Nicodemus
6cef3c6eb3 Add documentation for CreateBCryptHash 2015-04-13 12:35:25 -06:00
Lucas Nicodemus
e55c37728f Change config to refer to BCryptWorkFactor instead of WorkFactor.
Change default work factor to 7.
2015-04-13 11:33:04 -06:00