From cbb4904d3424bdaca6ffe1b1e37ce4f2b01baef6 Mon Sep 17 00:00:00 2001 From: Martin Walsh Date: Fri, 12 Jul 2019 09:48:37 +0100 Subject: [PATCH] Review Tweaks --- Auth0/Authentication.swift | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Auth0/Authentication.swift b/Auth0/Authentication.swift index 1643e28b3..eb612a428 100644 --- a/Auth0/Authentication.swift +++ b/Auth0/Authentication.swift @@ -178,8 +178,8 @@ public protocol Authentication: Trackable, Loggable { - parameter password: password for the new user - parameter connection: name where the user will be created (Database connection) - parameter userMetadata: additional userMetadata parameters that will be added to the newly created user. - - parameter rootAttributes: root attributes that will be added to the newly created user. - + - parameter rootAttributes: root attributes that will be added to the newly created user. See https://auth0.com/docs/api/authentication#signup for supported attributes. Will not overwrite existing parameters. + - returns: request that will yield a created database user (just email, username and email verified flag) */ // swiftlint:disable:next function_parameter_count @@ -634,7 +634,7 @@ public extension Authentication { - parameter password: password for the new user - parameter connection: name where the user will be created (Database connection) - parameter userMetadata: additional userMetadata parameters that will be added to the newly created user. - - parameter rootAttributes: root attributes that will be added to the newly created user. See https://auth0.com/docs/api/authentication#signup for supported attributes. + - parameter rootAttributes: root attributes that will be added to the newly created user. See https://auth0.com/docs/api/authentication#signup for supported attributes. Will not overwrite existing parameters. - returns: request that will yield a created database user (just email, username and email verified flag) */ @@ -642,6 +642,21 @@ public extension Authentication { return self.createUser(email: email, username: username, password: password, connection: connection, userMetadata: userMetadata, rootAttributes: rootAttributes) } + /** + Creates a user in a Database connection + + - parameter email: email of the user to create + - parameter username: username of the user if the connection requires username. By default is 'nil' + - parameter password: password for the new user + - parameter connection: name where the user will be created (Database connection) + - parameter userMetadata: additional userMetadata parameters that will be added to the newly created user. + + - returns: request that will yield a created database user (just email, username and email verified flag) + */ + func createUser(email: String, username: String? = nil, password: String, connection: String, userMetadata: [String: Any]? = nil) -> Request { + return self.createUser(email: email, username: username, password: password, connection: connection, userMetadata: userMetadata, rootAttributes: nil) + } + /** Creates a database user and then authenticates the user against Auth0.