forked from realByg/office-user-auto-create
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.html
162 lines (140 loc) · 10.1 KB
/
worker.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="https://blobs.officehome.msocdn.com/images/content/images/favicon-8f211ea639.ico" />
<title>Office 365</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mdui/0.4.3/css/mdui.min.css">
<script src="https://recaptcha.net/recaptcha/api.js" async defer></script>
<style>
@media screen and (max-width:600px){.mdui-toolbar>img{margin:auto}.hero>.mdui-typo-display-3{font-size:27px}.hero>.mdui-typo-title-opacity{font-size:15px}.enroll{padding:40px 15px!important}.email{display:block!important}}@media screen and (min-width:600px){.enroll{padding:50px 40px!important}}.enroll-mdui-dialog{max-width:inherit;overflow-x:hidden;overflow-y:scroll}.hero-bg{background:url(https://i.loli.net/2020/01/25/KEScJXCBfAzaIjW.png) no-repeat;background-size:cover;height:100vh;overflow:scroll}.hero-btn{width:120px;height:45px}.enroll{background-color:#fff;position:absolute;color:#000;padding:60px 60px 100px 60px;display:none}.code,.email{display:flex;align-items:flex-end;justify-content:space-between}
</style>
</head>
<body>
<div class="mdui-dialog" id="notice">
<div class="mdui-dialog-title">公告</div>
<div class="mdui-dialog-content">${notice}</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-confirm>我知道了</button>
</div>
</div>
<div class="mdui-dialog" id="usernameExists">
<div class="mdui-dialog-title">创建失败...</div>
<div class="mdui-dialog-content">用户名已存在,请重试!</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-confirm>我知道了</button>
</div>
</div>
<div class="mdui-dialog" id="wrongRecaptcha">
<div class="mdui-dialog-title">创建失败...</div>
<div class="mdui-dialog-content">人机验证错误!</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-confirm>我知道了</button>
</div>
</div>
<div class="mdui-dialog" id="invalidCode">
<div class="mdui-dialog-title">创建失败...</div>
<div class="mdui-dialog-content">激活码无效!</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-confirm>我知道了</button>
</div>
</div>
<div class="mdui-appbar">
<div class="mdui-toolbar" style="width: 85%; margin: auto">
<img class="mdui-img-fluid" src="https://i.loli.net/2020/04/21/ST9ru5mwVqUXnKO.png" alt="">
<span class="mdui-typo-display-1 mdui-hidden-xs">|</span>
<span class="mdui-typo-title mdui-hidden-xs">Office</span>
<div class="mdui-toolbar-spacer mdui-hidden-xs"></div>
<a class="mdui-typo-title mdui-hidden-xs" href="https://github.com/zayabighead/msautocreate"><i class="mdui-icon material-icons">account_circle</i></a>
</div>
</div>
<div class="hero-bg mdui-typo mdui-text-color-white-text mdui-valign">
<div class="hero mdui-col-xs-10 mdui-col-offset-xs-1 mdui-text-center">
<div class="mdui-center mdui-typo-display-3">${line1}</div>
<div class="mdui-typo-title-opacity">${line2}</div>
<br>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-m-a-1 hero-btn" id="getOffice">获取 Office</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-white mdui-m-a-1 hero-btn" onclick="window.location.href='https://office.com/login'">登录</button>
</div>
<div class="enroll-mdui-dialog mdui-dialog enroll mdui-col-xs-10 mdui-col-offset-xs-1 mdui-col-md-8 mdui-col-offset-md-2 mdui-shadow-8" id="enroll">
<div class="mdui-typo-title">获取账号</div>
<hr><br>
<form>
<div class="mdui-col-md-6 mdui-col-offset-md-3 mdui-col-xs-12" style="display: none" id="createdAccount">
<div class="mdui-textfield">
<i class="mdui-icon material-icons mdui-text-color-pink">email</i>
<p>邮箱:</p>
<input class="mdui-textfield-input" type="email" value="" id="email">
</div>
<div class="mdui-textfield">
<i class="mdui-icon material-icons mdui-text-color-pink">lock</i>
<p>初始密码:</p>
<input class="mdui-textfield-input" type="text" value="" id="password">
</div>
<br>
<br>
<a class="mdui-btn mdui-btn-raised mdui-ripple mdui-text-color-yellow mdui-color-pink" href="https://office.com/login" target="_blank" style="float: right">前往登录</a>
<div style="clear: both"></div>
</div>
<div class="mdui-progress" style="display: none">
<div class="mdui-progress-indeterminate"></div>
</div>
<div class="mdui-col-xs-12 mdui-col-md-6" id="accountInfo">
<div class="mdui-typo-subheading">账号信息:</div>
<br>
<div class="mdui-col-xs-12">
<span>订阅:</span>
<select class="mdui-select" name="subscription" mdui-select id="subscription">
${subscriptions}
</select>
</div>
<div class="mdui-textfield mdui-textfield-floating-label mdui-col-xs-12">
<label class="mdui-textfield-label">姓名</label>
<input class="mdui-textfield-input" type="text" maxlength="20" required id="displayname" name="displayname">
<div class="mdui-textfield-error">用户名仅限中文/英文/数字</div>
<div class="mdui-textfield-helper">账号展示的姓名</div>
</div>
<div class="email mdui-col-xs-12">
<div class="mdui-textfield mdui-textfield-floating-label" style="width: 100%">
<label class="mdui-textfield-label">用户名</label>
<input class="mdui-textfield-input" type="text" maxlength="20" required id="username" name="username" pattern="^[A-Za-z0-9]+$">
<div class="mdui-textfield-error">邮箱前缀仅限英文/数字</div>
<div class="mdui-textfield-helper">邮箱 @ 前面的字符</div>
</div>
<span class="mdui-hidden-xs"> </span>
<select class="mdui-select" mdui-select style="margin-bottom: 28px; color: black" name="domain" id="domain">
${domains}
</select>
</div>
<div style="clear: both"></div>
<br>
<br>
</div>
<div class="mdui-col-xs-12 mdui-col-md-5 mdui-col-offset-md-1" id="activation">
<div class="mdui-typo-subheading">激活信息:</div>
<div class="mdui-col-xs-12 code">
<div class="mdui-textfield mdui-textfield-floating-label" style="width: 100%">
<label class="mdui-textfield-label">激活码</label>
<input class="mdui-textfield-input" type="text" required id="code" name="code">
<div class="mdui-textfield-error">必填</div>
</div>
<span> </span>
<button class="mdui-btn mdui-color-pink mdui-ripple" style="margin-bottom: 28px; padding: 0" onclick="window.open('${code_store_link}')">获取激活码</button>
</div>
<div class="mdui-col-xs-12">
<br>
<div class="g-recaptcha" data-sitekey="${recaptcha_sitekey}"></div>
<br>
<input type="submit" class="mdui-col-xs-12 mdui-btn mdui-ripple mdui-color-pink hero-button" style="float: right" id="submit">
</div>
</div>
</form>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mdui/0.4.3/js/mdui.min.js"></script>
<script>
var $$=mdui.JQ;$$(document).ready(function(){""!=$$("#notice>.mdui-dialog-content").html()&&new mdui.Dialog("#notice").open()});var enroll=new mdui.Dialog("#enroll",{modal:!0});$$("#getOffice").on("click",function(e){enroll.open()}),$$("form").on("submit",function(e){e.preventDefault();var a={subscription:$$("#subscription").val(),displayname:$$("#displayname").val().trim(),username:$$("#username").val().trim(),domain:$$("#domain").val(),code:$$("#code").val().trim(),grecaptcha_token:grecaptcha.getResponse()};$$("#accountInfo, #activation").hide(),$$(".mdui-progress").show(),$$(".enroll").height("auto"),$$("hr").hide(),mdui.mutation(),$$.ajax({method:"POST",url:"/mscreate",data:JSON.stringify(a),contentType:"application/json",success:function(e){var a=JSON.parse(e);switch($$(".mdui-progress").hide(),$$("hr").show(),a.stat){case"success":$$("#createdAccount").show(),$$("#email").val(a.email),$$("#password").val(a.password);break;case"username exists":$$("#accountInfo, #activation").show(),enroll.close(),new mdui.Dialog("#usernameExists").open();break;case"wrong recaptcha":$$("#accountInfo, #activation").show(),enroll.close(),new mdui.Dialog("#wrongRecaptcha").open();break;case"invalid code":$$("#accountInfo, #activation").show(),enroll.close(),new mdui.Dialog("#invalidCode").open();break;default:enroll.close(),mdui.alert(e)}$$("#displayname").val(""),$$("#username").val(""),$$("#code").val(""),grecaptcha.reset(),$$(".enroll").height("auto")}})});
</script>
</body>
</html>