File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ public function setDisplayName($uid, $displayName) {
173173 *
174174 * @return void
175175 */
176- protected function storeUser ($ uid , $ groups = []) {
176+ protected function storeUser ($ uid , $ groups = [], $ email = '' ) {
177177 if (!$ this ->userExists ($ uid )) {
178178 $ query = \OC ::$ server ->getDatabaseConnection ()->getQueryBuilder ();
179179 $ query ->insert ('users_external ' )
@@ -189,6 +189,11 @@ protected function storeUser($uid, $groups = []) {
189189 \OC ::$ server ->getGroupManager ()->createGroup ($ group )->addUser ($ createduser );
190190 }
191191 }
192+
193+ if ($ email ) {
194+ $ config = \OC ::$ server ->getConfig ();
195+ $ config ->setUserValue ( $ uid , 'settings ' , 'email ' , $ email );
196+ }
192197 }
193198 }
194199
Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ public function checkPassword($uid, $password) {
6161 $ uid = str_replace ("%40 " , "@ " , $ uid );
6262 }
6363
64+ // Get email if uid contains @ symbol
65+ if ( str_contains ( $ uid , '@ ' ) ) $ email = $ uid ;
66+
6467 $ pieces = explode ('@ ' , $ uid );
6568 if ($ this ->domain !== '' ) {
6669 if (count ($ pieces ) === 1 ) {
@@ -104,7 +107,7 @@ public function checkPassword($uid, $password) {
104107 if ($ errorcode === 0 ) {
105108 curl_close ($ ch );
106109 $ uid = mb_strtolower ($ uid );
107- $ this ->storeUser ($ uid , $ groups );
110+ $ this ->storeUser ($ uid , $ groups, mb_strtolower ( $ email ) );
108111 return $ uid ;
109112 } elseif ($ errorcode === CURLE_COULDNT_CONNECT ||
110113 $ errorcode === CURLE_SSL_CONNECT_ERROR ||
You can’t perform that action at this time.
0 commit comments