-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
23 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import sys | ||
|
||
import ntust_me_mail as MailS | ||
import short_url | ||
import Helper | ||
|
||
|
@@ -88,7 +87,7 @@ def add(): | |
db.session.add(Visit(request.environ['REMOTE_ADDR'], 'add')) | ||
db.session.commit() | ||
|
||
return jsonify({'url': request.url_root + key}) | ||
return jsonify({'url': config['domain'] + key}) | ||
|
||
@app.route('/<key>', methods=['GET']) | ||
def go(key): | ||
|
@@ -99,28 +98,7 @@ def go(key): | |
db.session.add(Visit(request.environ['REMOTE_ADDR'], 'go')) | ||
db.session.commit() | ||
|
||
return redirect(result.url), 200 | ||
|
||
@app.route('/email/verify', methods=['GET']) | ||
def email_verify(): | ||
applier = Email_Apply.query.get(request.args['token']) | ||
|
||
if applier == None: | ||
return render_template('email_service_verify.html', message='申請失敗,請聯繫 [email protected]') | ||
else: | ||
password = MailS.get_random_password(12) | ||
|
||
MailS.add_smtp_credentials(applier.username, password) | ||
MailS.add_forward_route(applier.username, applier.email) | ||
|
||
email = applier.username + '@' + config['DOMAIN'] | ||
|
||
MailS.send_mail(email, 'NTUST.ME 電子信箱申請成功通知信', 'success_mail.html', data = {'name': applier.realname, 'email_address': email, 'password': password}) | ||
|
||
db.session.delete(applier) | ||
db.session.commit() | ||
|
||
return render_template('email_service_verify.html', message='申請成功,請檢視信箱,會有相關使用資訊') | ||
return redirect(result.url) | ||
|
||
if __name__ == '__main__': | ||
if sys.argv[1] == 'init': | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
Flask==0.10.1 | ||
Flask-SQLAlchemy==2.1 | ||
itsdangerous==0.24 | ||
Jinja2==2.8 | ||
MarkupSafe==0.23 | ||
click==8.0.3 | ||
dataclasses==0.8 | ||
Flask==2.0.2 | ||
Flask-SQLAlchemy==2.5.1 | ||
greenlet==1.1.2 | ||
gunicorn==20.1.0 | ||
importlib-metadata==4.8.1 | ||
itsdangerous==2.0.1 | ||
Jinja2==3.0.2 | ||
MarkupSafe==2.0.1 | ||
mysql-connector-python==8.0.15 | ||
protobuf==3.18.1 | ||
requests==2.9.1 | ||
short-url==1.2.1 | ||
SQLAlchemy==1.0.11 | ||
Werkzeug==0.11.3 | ||
wheel==0.24.0 | ||
SQLAlchemy==1.4.25 | ||
typing-extensions==3.10.0.2 | ||
Werkzeug==2.0.2 | ||
zipp==3.6.0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.