-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
689d34d
commit 1332603
Showing
16 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"enabled": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"api-key": { | ||
"name": "api-key", | ||
"type": "api-key", | ||
"disabled": false | ||
}, | ||
"local-userpass": { | ||
"name": "local-userpass", | ||
"type": "local-userpass", | ||
"config": { | ||
"autoConfirm": true, | ||
"resetFunctionName": "resetFunc", | ||
"runConfirmationFunction": false, | ||
"runResetFunction": true | ||
}, | ||
"disabled": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "FLE-Project-Cluster", | ||
"type": "mongodb-atlas", | ||
"config": { | ||
"clusterName": "FLE-Project-Cluster", | ||
"readPreference": "primary", | ||
"wireProtocolEnabled": false | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "6596bbc2032cebd75be23b3b", | ||
"roles": [ | ||
{ | ||
"name": "readAndWriteAll", | ||
"apply_when": {}, | ||
"read": true, | ||
"write": true, | ||
"insert": true, | ||
"delete": true, | ||
"search": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"values": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"values": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"values": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"values": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"values": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"name": "resetFunc", | ||
"private": false | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
This function will be run when the client SDK 'callResetPasswordFunction' is called with an object parameter that | ||
contains five keys: 'token', 'tokenId', 'username', 'password', and 'currentPasswordValid'. | ||
'currentPasswordValid' is a boolean will be true if a user changes their password by entering their existing | ||
password and the password matches the actual password that is stored. Additional parameters are passed in as part | ||
of the argument list from the SDK. | ||
The return object must contain a 'status' key which can be empty or one of three string values: | ||
'success', 'pending', or 'fail' | ||
'success': the user's password is set to the passed in 'password' parameter. | ||
'pending': the user's password is not reset and the UserPasswordAuthProviderClient 'resetPassword' function would | ||
need to be called with the token, tokenId, and new password via an SDK. (see below) | ||
const Realm = require("realm"); | ||
const appConfig = { | ||
id: "my-app-id", | ||
timeout: 1000, | ||
app: { | ||
name: "my-app-name", | ||
version: "1" | ||
} | ||
}; | ||
let app = new Realm.App(appConfig); | ||
let client = app.auth.emailPassword; | ||
await client.resetPassword(token, tokenId, newPassword); | ||
'fail': the user's password is not reset and will not be able to log in with that password. | ||
If an error is thrown within the function the result is the same as 'fail'. | ||
Example below: | ||
exports = ( | ||
{ token, tokenId, username, password, currentPasswordValid }, | ||
sendEmail, | ||
securityQuestionAnswer | ||
) => { | ||
// process the reset token, tokenId, username and password | ||
if (sendEmail) { | ||
context.functions.execute( | ||
"sendResetPasswordEmail", | ||
username, | ||
token, | ||
tokenId | ||
); | ||
// will wait for SDK resetPassword to be called with the token and tokenId | ||
return { status: "pending" }; | ||
} else if ( | ||
context.functions.execute( | ||
"validateSecurityQuestionAnswer", | ||
username, | ||
securityQuestionAnswer || currentPasswordValid | ||
) | ||
) { | ||
// will set the users password to the password parameter | ||
return { status: "success" }; | ||
} | ||
The uncommented function below is just a placeholder and will result in failure. | ||
*/ | ||
|
||
exports = ({ token, tokenId, username, password }) => { | ||
console.log("Please visit the App Services UI to fully configure your password reset function"); | ||
// will not reset the password | ||
return { status: 'fail' }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"use_natural_pluralization": true, | ||
"disable_schema_introspection": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"versions": [ | ||
"v1" | ||
], | ||
"run_as_user_id": "", | ||
"run_as_user_id_script_source": "", | ||
"log_function_arguments": false, | ||
"disabled": false, | ||
"validation_method": "NO_VALIDATION", | ||
"secret_name": "", | ||
"fetch_custom_user_data": false, | ||
"create_user_on_auth": false, | ||
"return_type": "JSON" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"app_id": "data-ieyeu", | ||
"config_version": 20210101, | ||
"name": "data", | ||
"location": "US-OR", | ||
"provider_region": "aws-us-west-2", | ||
"deployment_model": "LOCAL", | ||
"environment": "development" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"development_mode_enabled": false | ||
} |