@@ -69,29 +69,6 @@ function defaultJsonResponse(req, res) {
6969 helpers . strippedAccountResponse ( req . user , res ) ;
7070}
7171
72- /**
73- * The Stormpath API requires the `givenName` and `surname` fields to be
74- * provided, but as a convenience our framework integrations allow you to
75- * omit this data and fill those fields with the string `UNKNOWN` - but only
76- * if the field is not explicitly required.
77- *
78- * @function
79- *
80- * @param {Object } stormpathConfig - The express-stormpath configuration object
81- * @param {Object } req - The http request.
82- */
83- function applyDefaultAccountFields ( stormpathConfig , req ) {
84- var registerFields = stormpathConfig . web . register . form . fields ;
85-
86- if ( ( ! registerFields . givenName || ! registerFields . givenName . required || ! registerFields . givenName . enabled ) && ! req . body . givenName ) {
87- req . body . givenName = 'UNKNOWN' ;
88- }
89-
90- if ( ( ! registerFields . surname || ! registerFields . surname . required || ! registerFields . surname . enabled ) && ! req . body . surname ) {
91- req . body . surname = 'UNKNOWN' ;
92- }
93- }
94-
9572/**
9673 * Register a new user -- either via a JSON API, or via a browser.
9774 *
@@ -140,8 +117,6 @@ module.exports = function (req, res, next) {
140117 break ;
141118
142119 case 'POST' :
143- applyDefaultAccountFields ( config , req ) ;
144-
145120 handlePreRegistration ( req . body , function ( err ) {
146121 if ( err ) {
147122 return helpers . writeJsonError ( res , err ) ;
@@ -210,15 +185,6 @@ module.exports = function (req, res, next) {
210185 // to validate the user's data and create their account.
211186 case 'POST' :
212187 async . waterfall ( [
213- // What we'll do here is simply set default values for `givenName` and
214- // `surname`, because these value are annoying to set if you don't
215- // care about them. Eventually Stormpath is going to remove these
216- // required fields, but for now this is a decent workaround to ensure
217- // people don't have to deal with that stuff.
218- function ( callback ) {
219- applyDefaultAccountFields ( config , req ) ;
220- callback ( ) ;
221- } ,
222188 function ( callback ) {
223189 handlePreRegistration ( req . body , function ( err ) {
224190 if ( err ) {
0 commit comments