Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

login hooks #1235

Closed
tablatronix opened this Issue Jul 10, 2017 · 5 comments

Comments

Projects
None yet
2 participants
Owner

tablatronix commented Jul 10, 2017

Add login hooks similar to resetpw hooks i just added.
#1233

@tablatronix tablatronix added the Feature label Jul 10, 2017

@tablatronix tablatronix added this to the 3.4.0 milestone Jul 10, 2017

Owner

tablatronix commented Jul 10, 2017

exec_action('load-login');
exec_action('login-main'); // @hook login-main before passwword reset main html output
exec_action('login-extras'); // @hook login-extras

exec_filter('login',true); // @filter login filter bool allow
Owner

tablatronix commented Jul 10, 2017

beejay41 commented Oct 16, 2017

I'm having problems using the login filter.
Firstly, returning FALSE in the plugin filter function does not appear to be returned by exec_filter().
Secondly, any login filter needs information about the user, at least $USR, but better $data.

If the filter is called as follows, the plugin will have the user's details and can return the outcome of any checks:

	# do the username and password match?
	$allow = TRUE;
	exec_filter('login',[$data,&$allow]); // @filter login filter bool allow

In addition, the login-extras action would be easier to use if called before the render of the submit button, otherwise and extra fields will follow the button. The plugin could use some clever js or css to reposition its control, but that's unnecessary overhead.
Thanks

Edit:
Ignore my comment re $data - can use global, but return from filter is still and issue,

tablatronix added a commit that referenced this issue Oct 16, 2017

fixes #1235
oops uses loose comparison
moves login-extras before submit ( not sure if we have a standard for this )

Thanks, Shawn, I'd have never spotted that.
Login hook working as expected.

Owner

tablatronix commented Oct 17, 2017

Yeah I have been using typed languages lately, I sometimes forget php is very loose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment