How to log a user in via script


#1

SS42

in SS3, you can do this
Security::setCurrentUser($member);

but it seems not working any more?


#3

Just FYI, there is also a Member::actAs($member, $callback) which might be useful, depending on what you’re trying to do.

https://docs.silverstripe.org/en/4/developer_guides/security/member/#acting-as-another-user


#2

it actually works. forget to force the page to reload.


#4

Take a look here: Log in a member - Silverstripe 4


#5

@DorsetDigital great!