auto modify permission
add legacy login support