diff --git a/template/src/oj/account/two_factor_auth.html b/template/src/oj/account/two_factor_auth.html
new file mode 100644
index 0000000..fe35d74
--- /dev/null
+++ b/template/src/oj/account/two_factor_auth.html
@@ -0,0 +1,41 @@
+{% extends "oj_base.html" %}
+{% block title %}
+ 两步验证
+{% endblock %}
+{% block body %}
+
+
+
+
+
+ {% if not request.user.two_factor_auth %}
+
扫描二维码开启两步验证
+

+
+
+
+ {% else %}
+
两步验证已经开启
+ {% endif %}
+
+
+{% endblock %}
+
+{% block js_block %}
+
+{% endblock %}
diff --git a/utils/otp_auth.py b/utils/otp_auth.py
new file mode 100644
index 0000000..12773c4
--- /dev/null
+++ b/utils/otp_auth.py
@@ -0,0 +1,208 @@
+# -*- coding: utf-8 -*-
+"""
+ otpauth
+ ~~~~~~~
+
+ Implements two-step verification of HOTP/TOTP.
+
+ :copyright: (c) 2013 - 2015 by Hsiaoming Yang.
+ :license: BSD, see LICENSE for more details.
+"""
+import sys
+import time
+import hmac
+import base64
+import struct
+import hashlib
+import warnings
+
+
+if sys.version_info[0] == 3:
+ PY2 = False
+ string_type = str
+else:
+ PY2 = True
+ string_type = unicode
+ range = xrange
+
+
+__author__ = 'Hsiaoming Yang