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

Only set prefill values when client is initialized #855

Merged
merged 3 commits into from
Feb 6, 2017

Conversation

luisrudge
Copy link
Contributor

@luisrudge luisrudge commented Feb 3, 2017

fix #854

@luisrudge luisrudge changed the title only set prefill values when client is initialized. fix #854 Only set prefill values when client is initialized Feb 3, 2017
const { email, username } = options.prefill || {};
if (typeof email === "string") model = setEmail(model, email);
if (typeof username === "string") model = setUsername(model, username, "username", false);
this.prefill = options.prefill;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of adding state to the engine, I would put the prefill data into the model and get in from there. this way this keeps stateless and dependent only on the model

const { email, username } = this.prefill || {};
if (typeof email === "string") m = setEmail(m, email);
if (typeof username === "string") m = setUsername(m, username, "username", false);

return validateAllowedConnections(m);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should set the email before this, so the connection check runs over the allowed ones

@@ -38,11 +38,12 @@ export function setup(id, clientID, domain, options, hookRunner, emitEventFn) {
hashCleanup: options.hashCleanup === false ? false : true,
allowedConnections: Immutable.fromJS(options.allowedConnections || []),
ui: extractUIOptions(id, options),
defaultADUsernameFromEmailPrefix: options.defaultADUsernameFromEmailPrefix === false ? false : true
defaultADUsernameFromEmailPrefix: options.defaultADUsernameFromEmailPrefix === false ? false : true,
prefill: Immutable.fromJS(options.prefill || {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe dont wrap it? if you will end up unwrapping if

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@hzalaz hzalaz added this to the v10-Next milestone Feb 6, 2017
@hzalaz hzalaz merged commit 9ecc469 into master Feb 6, 2017
@hzalaz hzalaz deleted the fix/set-prefill-when-client-is-initialized branch February 6, 2017 20:14
@hzalaz hzalaz modified the milestones: v10-Next, v10.12.0 Mar 2, 2017
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.

prefill option gives "Please use your corporate email to login"
3 participants