背景:
1、公司使用腾讯玉符第三方统一登录,通过邮箱地址匹配账号,如果新入职人员可通过统一登录链接直接创建账号;
2、近期邮箱域名从@aaa.com改为了@bbb.com,老员工两个域名都可以使用(映射),新员工只有@bbb.com邮箱。
3、部分新员工由于不知名原因,登录时出现422 Sign-in using 统一登录 auth failed Sign-in failed because Email domain is not authorized for sign-up. Try logging in using your username or email. If you have forgotten your password, try recovering it
解决过程:
1、先怀疑是邮箱配置里 stmp_domain的配置问题(/etc/gitlab/gitlab.rb文件),注释掉并刷新gitlab配置再重启(gitlab-ctl reconfigure gitlab-ctl restart)后,问题并没有解决
2、进db控制台(gitlab-rails dbconsole),查询改用户的邮箱发现还是@aaa.com(脚本:select id, email , name , notification_email from users where notification_email like 'zhangsan%' ;)
3、直接修改其邮箱为@bbb.com(notification_email 是登录用的邮箱,脚本:update users set notification_email = 'zhangsan@bbb.com',email = 'zhangsan@bbb.com' where notification_email = 'zhangsan@aaa.com' ;)
4、用户重新使用统一登录即可以进入系统(可能会需要发送验证邮件?不确定是否肯定会)