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

feat: Add user login related attempts to ParseCloudUser #51

Merged
merged 4 commits into from
Jan 22, 2023

Conversation

cbaker6
Copy link
Member

@cbaker6 cbaker6 commented Jan 22, 2023

New Pull Request Checklist

Issue Description

ParseCloudUser is missing properties: _failed_login_count and _account_lockout_expires_at. These these can be added to a conforming type directly by the developer, adding them to the ParseCloudUser can ensure they are used correctly.

Approach

Add _failed_login_count and _account_lockout_expires_at to ParseCloudUser as getters only, preventing them from being set from Cloud Code. The Parse Server has routes and checks to increment/delete these properties at the necessary time. In Cloud Code, the developer may need to read these values to make a decision.

Though these properties are not written in a Swifty way (they are not lowerCamelCase) they are left as-is to prevent writing encoding keys for ParseCloudUser as this is how they look on the Parse Server.

TODOs before merging

  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)

@codecov
Copy link

codecov bot commented Jan 22, 2023

Codecov Report

Merging #51 (6fab2c5) into main (6cca2ff) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
- Coverage   90.44%   90.41%   -0.03%     
==========================================
  Files         163      163              
  Lines       16492    16492              
==========================================
- Hits        14916    14912       -4     
- Misses       1576     1580       +4     
Impacted Files Coverage Δ
Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift 74.52% <0.00%> (-0.59%) ⬇️
Sources/ParseSwift/Coding/ParseEncoder.swift 77.68% <0.00%> (-0.46%) ⬇️
Sources/ParseSwift/Objects/ParseObject.swift 90.52% <0.00%> (+0.10%) ⬆️
Sources/ParseSwift/Objects/ParseUser.swift 88.37% <0.00%> (+0.14%) ⬆️
Sources/ParseSwift/Objects/ParseObject+async.swift 96.66% <0.00%> (+0.37%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -15,4 +15,9 @@
public protocol ParseCloudUser: ParseUser {
/// The session token of the `ParseUser`.
var sessionToken: String? { get set }
/// The number of unsuccessful login attempts.
var _failed_login_count: Int? { get }

Check warning

Code scanning / Tailor (reported by Codacy)

Variable names should be lowerCamelCase

Variable names should be lowerCamelCase
var _failed_login_count: Int? { get }
/// The date the lockout expires. After this date, the `ParseUser`
/// can attempt to login again.
var _account_lockout_expires_at: Date? { get }

Check warning

Code scanning / Tailor (reported by Codacy)

Variable names should be lowerCamelCase

Variable names should be lowerCamelCase
@cbaker6 cbaker6 merged commit d6a05a9 into main Jan 22, 2023
@cbaker6 cbaker6 deleted the updateCloudCode branch January 22, 2023 15:26
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.

None yet

1 participant