13
13
* via an SSO strategy, we link this passport to your exsiting account. There is just one exception,
14
14
* which are SSO strategies which "exclusively" manage a domain.
15
15
* 2. If you're not signed in and try to sign in, this checks if there is already an account – and creates it if not.
16
- * 3. If you sign in and the SSO strategy is set to "update_on_login", it will reset the name of the user to the
17
- * data from the SSO provider. However, the user can still modify the name.
16
+ * 3. If you sign in and the SSO strategy is set to "update_on_login",
17
+ * it will reset the name of the user to the data from the SSO provider.
18
+ * Users can only modify their first and last name, if that SSO mechanism isn't exclusive!
18
19
* 4. If you already have an email address belonging to a newly introduced exclusive domain, it will start to be controlled by it.
19
20
*/
20
21
@@ -45,8 +46,9 @@ import { sanitizeProfile } from "@cocalc/server/auth/sso/sanitize-profile";
45
46
import { callback2 as cb2 } from "@cocalc/util/async-utils" ;
46
47
import { is_valid_email_address } from "@cocalc/util/misc" ;
47
48
import { HELP_EMAIL } from "@cocalc/util/theme" ;
48
- import { emailBelongsToDomain , getEmailDomain } from "./ check-required-sso" ;
49
+ import { emailBelongsToDomain } from "@cocalc/util/auth- check-required-sso" ;
49
50
import { SSO_API_KEY_COOKIE_NAME } from "./consts" ;
51
+ import { getEmailDomain } from "@cocalc/util/auth-check-required-sso" ;
50
52
51
53
const logger = getLogger ( "server:auth:sso:passport-login" ) ;
52
54
@@ -240,7 +242,7 @@ export class PassportLogin {
240
242
const exclusiveDomains = strategy . info ?. exclusive_domains ?? [ ] ;
241
243
if ( ! isEmpty ( exclusiveDomains ) ) {
242
244
for ( const email of opts . emails ?? [ ] ) {
243
- const emailDomain = getEmailDomain ( email . toLocaleLowerCase ( ) ) ;
245
+ const emailDomain = getEmailDomain ( email . toLowerCase ( ) ) ;
244
246
for ( const ssoDomain of exclusiveDomains ) {
245
247
if ( emailBelongsToDomain ( emailDomain , ssoDomain ) ) {
246
248
return true ;
@@ -253,7 +255,7 @@ export class PassportLogin {
253
255
254
256
// similar to the above, for a specific email address
255
257
private checkEmailExclusiveSSO ( email_address : string ) : boolean {
256
- const emailDomain = getEmailDomain ( email_address . toLocaleLowerCase ( ) ) ;
258
+ const emailDomain = getEmailDomain ( email_address . toLowerCase ( ) ) ;
257
259
for ( const strategyName in this . opts . passports ) {
258
260
const strategy = this . opts . passports [ strategyName ] ;
259
261
for ( const ssoDomain of strategy . info ?. exclusive_domains ?? [ ] ) {
@@ -510,7 +512,7 @@ export class PassportLogin {
510
512
}
511
513
512
514
// We update the email address, if it does not belong to another account.
513
-
515
+
514
516
if ( is_valid_email_address ( locals . email_address ) ) {
515
517
upd . email_address = locals . email_address ;
516
518
}
0 commit comments