MDL-39352 group password poilcy:fixed password policy check on group formation

https://tracker.moodle.org/browse/MDL-39352?focusedCommentId=219239&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-219239

I have created a patch for this
patch file- https://github.com/RO-29/moodle/tree/MDL-39352
compare-file- https://github.com/RO-29/moodle/compare/master...MDL-39352 
although the enrolment key is complying password policy but only on the time when changing password in group settings
i have tried to fixed this issue to force check password policy on time of group formation too 
applying the patch doesn't seems to break any existing code and have tried this on MOODLE_23_STABLE, MOODLE_24_STABLE 
location for code is moodle/group/group_form.php