Featured image of post Office365 用户自助注册管理面板 O365-UC

Office365 用户自助注册管理面板 O365-UC

Office 365帐户自动注册管理面板 O365-UC

office365_auto_register.png

注:ubuntu18.04测试无问题

作者:https://github.com/HuJK/O365-UC

需求

1
2
sudo apt install tmux python3 python3-pip
sudo pip3 install tornado

安装

1
2
3
4
5
6
7
8
git clone https://github.com/HuJK/O365-UC.git

cd O365-UC/backend/
# 在后台运行
tmux new -d -s o365 python3 o365-creater_api.py
# 在前台运行
# 别着急复制,看下面注意
python3 o365-creater_api.py

注意:

运行完python3 o365-creater_api.py

这个后,由于是控制台运行,所以你把SSH一关,程序也就断了

为了上程序在关闭SSH后依旧能运行,需要个工具

1
2
3
4
5
安装screen
apt install screen

然后在前台运行的python3 o365-creater_api.py这句应该改成
screen python3 o365-creater_api.py

用法

浏览器访问:https://你的ip:12536

默认后台密码:admin

**注意:https"//**访问,不然打不开,作者很奇怪,为了安全嘛?

后台设置

Client ID and Secret

①:先点击PREPARE 然后后面的按钮才会变蓝

然后点击 GET CLIENT ID AND SECRER,浏览器会跳转到office 365登录界面

如图:

office365_auto_register_1

②:登录账户,获取应用机密和ID,复制过去点保存

office365_auto_register_2

Grant Permission and Get Code

③:点击 PREPARE 按钮后,GEANT PERMISSOINS按钮变成蓝色,点击会跳转授权界面

肯定就是点击接受了

office365_auto_register_3

④:上一步接受完成后,等待几秒会自动跳转会来,并且自动填好Token的

⑤:设置基本就是完成了,一下细节自己再鼓捣就行了

别忘了点保存

详细看图

office365_auto_register_4

⑥:回到前台试试,能用

office365_auto_register_5

配置邀请码

这个它文档是这样写的:

invite_code文件夹中,每个文件名是一个代码,内容是使用率计数

确保这些文件仅包含数字。没有任何换行符或[0-9]以外的任何其他字符

或者,您可以编写自己的邀请代码检查算法。只需在backend/o365_creater_auth.py文件中编辑86行到103行即可:

如果您更改此设置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
    def check(self,password):
        i_path = os.path.join(self.invite_code_path,password)
        if os.path.isfile(i_path):
            with open(i_path) as i_fileHendler:
                use_left = int(i_fileHendler.read())
            if use_left < 0:
                return True
            elif use_left == 0:
                os.remove(i_path)
                return False
            elif use_left == 1:
                os.remove(i_path)
                return True
            else:
                with open(i_path,"w") as i_fileHendler:
                    i_fileHendler.write(str(use_left - 1))
                return True
        return False

to this:

1
2
3
   def check(self,password):
       import math
       return 0== sum([ True if int(password)%factor == 0 else False for factor in ( [2] + list(range(3,int(math.sqrt(int(password))),2) )) ]) and int(password) > 1000000000

any prime number which > 1000000000 wil be considered to a valid invite code

萌ICP备 20202244号
Built with Hugo
主题 StackJimmy 设计
访问量 - span> span> 访客数 - span>人次 span> i> 本文总阅读量