File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ public function setDisplayName($uid, $displayName) {
195195 *
196196 * @return void
197197 */
198- protected function storeUser ($ uid , $ groups = []) {
198+ protected function storeUser ($ uid , $ groups = [], $ email = '' ) {
199199 if (!$ this ->userExists ($ uid )) {
200200 $ query = $ this ->db ->getQueryBuilder ();
201201 $ query ->insert ('users_external ' )
@@ -211,6 +211,11 @@ protected function storeUser($uid, $groups = []) {
211211 $ this ->groupManager ->createGroup ($ group )->addUser ($ createduser );
212212 }
213213 }
214+
215+ if ($ email ) {
216+ $ createduser = \OC ::$ server ->getUserManager ()->get ($ uid );
217+ $ createduser ->setSystemEMailAddress ($ email );
218+ }
214219 }
215220 }
216221
Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ public function checkPassword($uid, $password) {
6464 $ uid = str_replace ('%40 ' , '@ ' , $ uid );
6565 }
6666
67+ // Get email if uid is a valid email address
68+ if (filter_var ($ uid , FILTER_VALIDATE_EMAIL )) $ email = mb_strtolower ($ uid );
69+
6770 $ pieces = explode ('@ ' , $ uid );
6871 if ($ this ->domain !== '' ) {
6972 if (count ($ pieces ) === 1 ) {
@@ -107,7 +110,7 @@ public function checkPassword($uid, $password) {
107110 if ($ errorcode === 0 ) {
108111 curl_close ($ ch );
109112 $ uid = mb_strtolower ($ uid );
110- $ this ->storeUser ($ uid , $ groups );
113+ $ this ->storeUser ($ uid , $ groups, $ email );
111114 return $ uid ;
112115 } elseif ($ errorcode === CURLE_COULDNT_CONNECT
113116 || $ errorcode === CURLE_SSL_CONNECT_ERROR
You can’t perform that action at this time.
0 commit comments