authboss icon indicating copy to clipboard operation
authboss copied to clipboard

"Remember me" enabled by default if module installed

Open frederikhors opened this issue 5 years ago • 5 comments

Issue opened for the creation of a wiki page that summarizes the doubts and problems for newbies (https://github.com/volatiletech/authboss/issues/210).


  • https://github.com/volatiletech/authboss/blob/master/remember/remember.go#L43-L48
  • https://github.com/volatiletech/authboss/blob/master/values.go#L69-L76
  • https://github.com/volatiletech/authboss/blob/master/defaults/values.go#L52-L56

I have read these lines but I have not been able to understand if there is a way to avoid the rm field in the login form and activate the "remember me" module by default if present.

In other words if in my authboss.Config there is a (let's say) AutoRememberMe = true option I want enable by default the "Remember me" module as if in my form I had checked the rm field.

Does this make sense?

frederikhors avatar Feb 01 '20 20:02 frederikhors

Turning the module off is done by not importing the module. Is there a reason you'd want to both import it but also not use it?

aarondl avatar Feb 10 '20 03:02 aarondl

I badly explained myself. I'm sorry.

I would like to avoid passing the "rm = true" field from the client (javascript or server-rendered form) during the login phase.

frederikhors avatar Feb 10 '20 12:02 frederikhors

Ah, you would need to add a new feature to the remember me module to "always remember". But I think you would just add a hidden field called rm.

aarondl avatar Feb 11 '20 06:02 aarondl

you would just add a hidden field called rm

Yep. I'm doing this right now. But I think it's an hacky way. Don't you think?

frederikhors avatar Feb 11 '20 09:02 frederikhors

That's why I said you either have to do that or add a feature to authbosses module haha. I think that in the realm of hacky things this is one of the least hacky things there is. It's like sending a parameter into a function. No big deal. Costs next to nothing.

aarondl avatar Feb 11 '20 14:02 aarondl