Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
925760ad
Commit
925760ad
authored
Oct 09, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
集成前端样式
parent
9fdf4a14
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
432 additions
and
236 deletions
+432
-236
SiteController.php
src/frontend/controllers/SiteController.php
+34
-29
LoginForm.php
src/frontend/models/LoginForm.php
+21
-2
PasswordResetRequestForm.php
src/frontend/models/PasswordResetRequestForm.php
+2
-0
ResetPasswordForm.php
src/frontend/models/ResetPasswordForm.php
+9
-0
SignupForm.php
src/frontend/models/SignupForm.php
+11
-2
TokenInputForm.php
src/frontend/models/TokenInputForm.php
+7
-1
main.php
src/frontend/views/layouts/main.php
+25
-19
index.php
src/frontend/views/site/index.php
+0
-79
login.php
src/frontend/views/site/login.php
+46
-20
requestPasswordResetToken.php
src/frontend/views/site/requestPasswordResetToken.php
+36
-16
resetPassword.php
src/frontend/views/site/resetPassword.php
+30
-12
resetPasswordSuccess.php
src/frontend/views/site/resetPasswordSuccess.php
+32
-4
signup.php
src/frontend/views/site/signup.php
+56
-34
tokenInput.php
src/frontend/views/site/tokenInput.php
+36
-11
request_password_reset.js
src/frontend/web/js/site/request_password_reset.js
+2
-2
signup.js
src/frontend/web/js/site/signup.js
+39
-4
token_input.js
src/frontend/web/js/site/token_input.js
+44
-0
webpack.config.js
src/frontend/web/webpack.config.js
+1
-0
注册.html
ui/html/注册.html
+1
-1
No files found.
src/frontend/controllers/SiteController.php
View file @
925760ad
...
@@ -36,6 +36,13 @@ class SiteController extends Controller
...
@@ -36,6 +36,13 @@ class SiteController extends Controller
const
REDIS_SIGNUP_MSG_EXPIRE
=
60
;
//second
const
REDIS_SIGNUP_MSG_EXPIRE
=
60
;
//second
const
SIGNUP_TOKEN
=
'sign_token'
;
const
SIGNUP_TOKEN
=
'sign_token'
;
/**
* 默认action
* @var string
*/
public
$defaultAction
=
'login'
;
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
@@ -46,15 +53,16 @@ class SiteController extends Controller
...
@@ -46,15 +53,16 @@ class SiteController extends Controller
'class'
=>
AccessControl
::
className
(),
'class'
=>
AccessControl
::
className
(),
'only'
=>
[
'logout'
,
'signup'
],
'only'
=>
[
'logout'
,
'signup'
],
'rules'
=>
[
'rules'
=>
[
[
[
'actions'
=>
[
'
signup
'
],
'actions'
=>
[
'
logout
'
],
'allow'
=>
TRUE
,
'allow'
=>
TRUE
,
'roles'
=>
[
'
?
'
],
'roles'
=>
[
'
@
'
],
],
],
[
[
'actions'
=>
[
'
logout
'
],
'actions'
=>
[
'
signup
'
],
'allow'
=>
TRUE
,
'allow'
=>
TRUE
,
'roles'
=>
[
'
@
'
],
'roles'
=>
[
'
?
'
],
],
],
],
],
],
],
...
@@ -83,15 +91,6 @@ class SiteController extends Controller
...
@@ -83,15 +91,6 @@ class SiteController extends Controller
];
];
}
}
/**
* Displays homepage.
*
* @return mixed
*/
public
function
actionIndex
()
{
return
$this
->
render
(
'index'
);
}
/**
/**
* Logs in a user.
* Logs in a user.
...
@@ -174,7 +173,9 @@ class SiteController extends Controller
...
@@ -174,7 +173,9 @@ class SiteController extends Controller
$model
->
from
=
(
int
)
$from
;
$model
->
from
=
(
int
)
$from
;
$token
=
$request
->
post
(
'token'
);
$token
=
$request
->
post
(
'token'
);
$telephone
=
$request
->
post
(
'telephone'
);
$telephone
=
$request
->
post
(
'telephone'
);
if
(
$model
->
load
(
$request
->
post
())
&&
$token
.
$telephone
===
Yii
::
$app
->
session
->
get
(
self
::
SIGNUP_TOKEN
))
{
if
(
$model
->
load
(
$request
->
post
()))
{
//token 错误
if
(
$token
.
$telephone
===
Yii
::
$app
->
session
->
get
(
self
::
SIGNUP_TOKEN
))
{
$geetestChallenge
=
$request
->
post
(
'geetest_challenge'
);
$geetestChallenge
=
$request
->
post
(
'geetest_challenge'
);
$geetestSeccode
=
$request
->
post
(
'geetest_seccode'
);
$geetestSeccode
=
$request
->
post
(
'geetest_seccode'
);
$geetestValidate
=
$request
->
post
(
'geetest_validate'
);
$geetestValidate
=
$request
->
post
(
'geetest_validate'
);
...
@@ -194,6 +195,10 @@ class SiteController extends Controller
...
@@ -194,6 +195,10 @@ class SiteController extends Controller
return
$this
->
goHome
();
return
$this
->
goHome
();
}
}
}
}
}
else
{
$model
->
addError
(
'token'
,
'验证码错误'
);
}
}
}
return
$this
->
render
(
'signup'
,
[
return
$this
->
render
(
'signup'
,
[
...
...
src/frontend/models/LoginForm.php
View file @
925760ad
...
@@ -16,11 +16,16 @@ class LoginForm extends Model
...
@@ -16,11 +16,16 @@ class LoginForm extends Model
const
REDIS_KEY_PREFIX
=
'login_ip'
;
const
REDIS_KEY_PREFIX
=
'login_ip'
;
public
$telephone
;
public
$telephone
;
public
$password
;
public
$password
;
public
$rememberMe
=
TRUE
;
public
$rememberMe
;
private
$_user
;
private
$_user
;
public
function
formname
()
{
return
''
;
}
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
@@ -37,6 +42,17 @@ class LoginForm extends Model
...
@@ -37,6 +42,17 @@ class LoginForm extends Model
];
];
}
}
/**
* @return array
*/
public
function
attributeLabels
()
{
return
[
'telephone'
=>
'手机号码'
,
'password'
=>
'密码'
,
];
}
/**
/**
* Validates the password.
* Validates the password.
* This method serves as the inline validation for password.
* This method serves as the inline validation for password.
...
@@ -63,7 +79,7 @@ class LoginForm extends Model
...
@@ -63,7 +79,7 @@ class LoginForm extends Model
if
(
$value
!==
NULL
)
{
if
(
$value
!==
NULL
)
{
$redis
->
decr
(
$key
);
$redis
->
decr
(
$key
);
}
}
$this
->
addError
(
$attribute
,
'
Incorrect telephone or password.
'
);
$this
->
addError
(
$attribute
,
'
用户名或者密码错误
'
);
}
}
}
}
}
}
...
@@ -75,6 +91,9 @@ class LoginForm extends Model
...
@@ -75,6 +91,9 @@ class LoginForm extends Model
*/
*/
public
function
login
()
public
function
login
()
{
{
if
(
$this
->
rememberMe
===
NULL
)
{
$this
->
rememberMe
=
FALSE
;
}
if
(
$this
->
validate
())
{
if
(
$this
->
validate
())
{
return
Yii
::
$app
->
user
->
login
(
$this
->
getUser
(),
$this
->
rememberMe
?
3600
*
24
*
30
:
0
);
return
Yii
::
$app
->
user
->
login
(
$this
->
getUser
(),
$this
->
rememberMe
?
3600
*
24
*
30
:
0
);
}
else
{
}
else
{
...
...
src/frontend/models/PasswordResetRequestForm.php
View file @
925760ad
...
@@ -34,6 +34,8 @@ class PasswordResetRequestForm extends Model
...
@@ -34,6 +34,8 @@ class PasswordResetRequestForm extends Model
}
}
public
function
sendMsg
()
public
function
sendMsg
()
{
{
/* @var $user User */
/* @var $user User */
...
...
src/frontend/models/ResetPasswordForm.php
View file @
925760ad
...
@@ -19,6 +19,15 @@ class ResetPasswordForm extends Model
...
@@ -19,6 +19,15 @@ class ResetPasswordForm extends Model
private
$_user
;
private
$_user
;
/**
* @inheritdoc
*/
public
function
formname
()
{
return
""
;
}
/**
/**
* ResetPasswordForm constructor.
* ResetPasswordForm constructor.
* @param array $telephone
* @param array $telephone
...
...
src/frontend/models/SignupForm.php
View file @
925760ad
...
@@ -28,8 +28,8 @@ class SignupForm extends Model
...
@@ -28,8 +28,8 @@ class SignupForm extends Model
return
[
return
[
[
'telephone'
,
'trim'
],
[
'telephone'
,
'trim'
],
[[
'telephone'
,
'from'
],
'required'
],
[[
'telephone'
,
'from'
],
'required'
],
[
'telephone'
,
'unique'
,
'targetClass'
=>
'\common\models\User'
,
'message'
=>
'
This telephone has already been taken.
'
],
[
'telephone'
,
'unique'
,
'targetClass'
=>
'\common\models\User'
,
'message'
=>
'
该电话号码已经被注册
'
],
[
'telephone'
,
'
string'
,
'length'
=>
11
],
[
'telephone'
,
'
validateTelephone'
],
[[
'password'
,
'rePassword'
],
'required'
],
[[
'password'
,
'rePassword'
],
'required'
],
[
'password'
,
'string'
,
'min'
=>
6
],
[
'password'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'string'
,
'min'
=>
6
],
...
@@ -73,4 +73,13 @@ class SignupForm extends Model
...
@@ -73,4 +73,13 @@ class SignupForm extends Model
}
}
/**
* @param $attribute
*/
public
function
validateTelephone
(
$attribute
)
{
if
(
!
Utils
::
isTelephone
(
$this
->
telephone
))
{
$this
->
addError
(
$attribute
,
'请输入正确的手机号码'
);
}
}
}
}
src/frontend/models/TokenInputForm.php
View file @
925760ad
...
@@ -33,11 +33,17 @@ class TokenInputForm extends Model
...
@@ -33,11 +33,17 @@ class TokenInputForm extends Model
];
];
}
}
/**
* @inheritdoc
*/
public
function
formname
()
{
return
""
;
}
/**
/**
* 验证token是否有效
* 验证token是否有效
* @param $telephone
* @param $telephone
* @param $token
* @return bool
* @return bool
*/
*/
public
function
isTokenValid
(
$telephone
)
public
function
isTokenValid
(
$telephone
)
...
...
src/frontend/views/layouts/main.php
View file @
925760ad
...
@@ -4,15 +4,11 @@
...
@@ -4,15 +4,11 @@
/* @var $content string */
/* @var $content string */
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\bootstrap\Nav
;
use
yii\bootstrap\NavBar
;
use
yii\widgets\Breadcrumbs
;
use
frontend\assets\AppAsset
;
use
frontend\assets\AppAsset
;
use
common\widgets\Alert
;
AppAsset
::
register
(
$this
);
AppAsset
::
register
(
$this
);
AppAsset
::
addCss
(
$this
,
'@web/assets/css/login_css.css'
);
AppAsset
::
addCss
(
$this
,
'@web/assets/css/login_css.css'
);
$baseUrl
=
\yii\helpers\Url
::
base
();
?>
?>
<?php
$this
->
beginPage
()
?>
<?php
$this
->
beginPage
()
?>
...
@@ -20,16 +16,16 @@ AppAsset::addCss($this, '@web/assets/css/login_css.css');
...
@@ -20,16 +16,16 @@ AppAsset::addCss($this, '@web/assets/css/login_css.css');
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<html
lang=
"
<?=
Yii
::
$app
->
language
?>
"
>
<html
lang=
"
<?=
Yii
::
$app
->
language
?>
"
>
<title>
注册/登录
</title>
<title>
<?=
$this
->
title
?>
</title>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
?>
"
>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
?>
"
>
<meta
name=
"description"
content=
""
>
<meta
name=
"description"
content=
""
>
<meta
name=
"keywords"
content=
""
>
<meta
name=
"keywords"
content=
""
>
<!-- Use latest IE randering angine and switch on chrome Frame if available -->
<!-- Use latest IE randering angine and switch on chrome Frame if available -->
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<link
rel=
"shortcut icon"
href=
"
<?=
AppAsset
::
getStaticUrl
(
'img/favicon.ico'
)
?>
"
>
<link
rel=
"shortcut icon"
href=
"
<?=
AppAsset
::
getStaticUrl
(
'img/favicon.ico'
)
?>
"
>
<?=
Html
::
csrfMetaTags
()
?>
<?=
Html
::
csrfMetaTags
()
?>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
()
?>
<?php
$this
->
head
()
?>
</head>
</head>
<body>
<body>
<?php
$this
->
beginBody
()
?>
<?php
$this
->
beginBody
()
?>
...
@@ -37,8 +33,20 @@ AppAsset::addCss($this, '@web/assets/css/login_css.css');
...
@@ -37,8 +33,20 @@ AppAsset::addCss($this, '@web/assets/css/login_css.css');
<nav
class=
"navbar navbar-main navbar-static-top"
>
<nav
class=
"navbar navbar-main navbar-static-top"
>
<div
class=
"logo pull-left"
>
云涯 YunYa
</div>
<div
class=
"logo pull-left"
>
云涯 YunYa
</div>
<ul
class=
"nav navbar-nav pull-right yun-login-btn"
>
<ul
class=
"nav navbar-nav pull-right yun-login-btn"
>
<li><a
href=
"#"
>
登录
</a></li>
<?php
if
(
Yii
::
$app
->
user
->
isGuest
)
:
?>
<li
class=
"active"
><a
href=
"#"
>
注册
</a></li>
<li><a
href=
"
<?=
$baseUrl
.
"/site/login"
?>
"
>
登录
</a></li>
<li><a
href=
"
<?=
$baseUrl
.
"/site/signup"
?>
"
>
注册
</a></li>
<?php
else
:
?>
<?=
'<li>'
.
Html
::
beginForm
([
'/site/logout'
],
'post'
)
.
Html
::
submitButton
(
'Logout ('
.
Yii
::
$app
->
user
->
identity
->
username
.
')'
)
.
Html
::
endForm
()
.
'</li>'
;
?>
<?php
endif
;
?>
</ul>
</ul>
</nav>
</nav>
...
@@ -49,8 +57,6 @@ AppAsset::addCss($this, '@web/assets/css/login_css.css');
...
@@ -49,8 +57,6 @@ AppAsset::addCss($this, '@web/assets/css/login_css.css');
</div>
</div>
<?php
$this
->
endBody
()
?>
<?php
$this
->
endBody
()
?>
</body>
</body>
</html>
</html>
...
...
src/frontend/views/site/index.php
deleted
100644 → 0
View file @
9fdf4a14
<?php
/* @var $this yii\web\View */
$this
->
title
=
'云崖'
;
?>
<div
class=
"z-m-center"
>
<h3>
云涯
</h3>
<p>
欢迎来到最课堂,专注在线直播
</p>
<div
id=
"myTab"
class=
"tab-a"
>
<ul>
<li><a
href=
"#login"
data-toggle=
"tab"
>
登录
</a></li>
<li
class=
"active"
><a
href=
"#register"
data-toggle=
"tab"
>
注册
</a></li>
</ul>
</div>
<div
class=
"tab-content"
id=
"myTabContent"
>
<div
class=
"tab-pane fade"
id=
"login"
>
<div
class=
"reg-box"
>
<div
class=
"phone input-wrapper"
>
<input
type=
"text"
class=
""
placeholder=
"手机号码"
required=
""
autofocus=
""
>
<span
class=
"tips"
>
手机号或者密码错误
</span>
</div>
<div
class=
"password input-wrapper last-wrapper"
>
<input
type=
"password"
class=
""
placeholder=
"密码"
required=
""
>
</div>
</div>
<div
class=
"checkbox part-wap"
>
<label>
<input
type=
"checkbox"
value=
"remember-me"
>
记住密码
</label>
<a
href=
"#"
>
忘记密码?
</a>
</div>
<div
class=
"foot-reg-btn"
>
<button
class=
"btn btn-log"
type=
"submit"
>
登录
</button>
</div>
<div
class=
"div-line"
>
或
</div>
<div
class=
"foot-reg-btn"
>
<button
class=
"btn btn-reg"
type=
"submit"
>
微信登录
</button>
</div>
</div>
<div
class=
"tab-pane fade in active"
id=
"register"
>
<div
class=
"reg-box"
>
<div
class=
"phone input-wrapper"
>
<input
type=
"text"
class=
""
placeholder=
"手机号码"
required=
""
autofocus=
""
>
<span
class=
"tips"
>
手机号或者密码错误
</span>
</div>
<div
class=
"v-code input-wrapper"
>
<input
type=
"text"
class=
""
placeholder=
"验证码"
required=
""
>
<button
class=
"btn btn-get-vcode"
>
获取验证码
</button>
<span
class=
"tips tip-vcode"
>
验证码错误
</span>
</div>
<div
class=
"password input-wrapper"
>
<input
type=
"password"
class=
""
placeholder=
"输入密码"
required=
""
>
</div>
<div
class=
"check-password input-wrapper last-wrapper"
>
<input
type=
"password"
class=
""
placeholder=
"再次输入密码"
required=
""
>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<button
class=
"btn btn-reg"
type=
"submit"
>
注册
</button>
</div>
</div>
</div>
</div>
src/frontend/views/site/login.php
View file @
925760ad
<?php
<?php
/* @var $this yii\web\View */
use
yii\widgets\ActiveForm
;
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */
use
yii\helpers\Html
;
/* @var $this yii\web\View */
use
yii\bootstrap\ActiveForm
;
$this
->
title
=
'
Login
'
;
$this
->
title
=
'
登录
'
;
$
this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$
baseUrl
=
\yii\helpers\Url
::
base
()
;
?>
?>
<div
class=
"site-login"
>
<div
class=
"z-m-center"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<h3>
云涯
</h3>
<p>
欢迎来到最课堂,专注在线直播
</p>
<p>
Please fill out the following fields to login:
</p>
<div
id=
"myTab"
class=
"tab-a"
>
<ul>
<li
class=
"active"
><a
href=
"
<?=
$baseUrl
.
"/site/login"
?>
"
data-toggle=
"tab"
>
登录
</a></li>
<li><a
href=
"
<?=
$baseUrl
.
"/site/singup"
?>
"
data-toggle=
"tab"
>
注册
</a></li>
</ul>
</div>
<div
class=
"row"
>
<div
class=
"tab-content"
id=
"myTabContent"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'login-form'
]);
?>
<?=
$form
->
field
(
$model
,
'telephone'
)
->
textInput
([
'autofocus'
=>
TRUE
])
?>
<div
class=
"tab-pane fade in active"
id=
"login"
>
<div
class=
"reg-box"
>
<?php
$form
=
ActiveForm
::
begin
(
[
'id'
=>
'login-form'
,
]);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<?=
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
()
?>
<div
class=
" input-wrapper"
>
<input
name=
"telephone"
value=
"
<?=
$model
->
telephone
?>
"
type=
"text"
class=
""
placeholder=
"手机号码"
autofocus=
""
>
</div>
<div
class=
" input-wrapper last-wrapper"
>
<input
name=
"password"
type=
"password"
class=
""
placeholder=
"密码"
>
<span
class=
"tips tip-vcode"
>
<?=
$model
->
getFirstError
(
'password'
)
?>
</span>
<div
style=
"color:#999;margin:1em 0"
>
</div>
If you forgot your password you can
<?=
Html
::
a
(
'reset it'
,
[
'site/request-password-reset'
])
?>
.
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"checkbox part-wap"
>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
,
'name'
=>
'login-button'
])
?>
<label>
<?=
$model
->
rememberMe
?>
<input
name=
"rememberMe"
type=
"checkbox"
value=
"1"
<?=
$model
->
rememberMe
?
"checked"
:
''
?>
>
记住密码
</label>
<a
href=
"
<?=
$baseUrl
.
"/site/request-password-reset"
?>
"
>
忘记密码?
</a>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<button
class=
"btn btn-log"
type=
"submit"
>
登录
</button>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
<!-- <div class="div-line">或</div>-->
<!---->
<!-- <div class="foot-reg-btn">-->
<!-- <button class="btn btn-reg" type="submit">微信登录</button>-->
<!-- </div>-->
</div>
</div>
</div>
</div>
</div>
</div>
src/frontend/views/site/requestPasswordResetToken.php
View file @
925760ad
...
@@ -7,33 +7,53 @@
...
@@ -7,33 +7,53 @@
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\bootstrap\ActiveForm
;
use
yii\bootstrap\ActiveForm
;
$this
->
title
=
'
Request password reset
'
;
$this
->
title
=
'
找回密码
'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/request_password_reset.js'
);
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/request_password_reset.js'
);
$this
->
registerJsFile
(
'http://static.geetest.com/static/tools/gt.js'
);
$this
->
registerJsFile
(
'http://static.geetest.com/static/tools/gt.js'
);
?>
?>
<div
class=
"site-request-password-reset"
>
<div
class=
"z-m-center"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<h3>
找回密码
</h3>
<p>
请按步骤获取密码
</p>
<div
id=
"myTab"
class=
"tab-find"
>
<ul>
<li
class=
"active"
><a
href=
"javascript:;"
data-toggle=
"tab"
>
1
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
2
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
3
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
4
</a></li>
</ul>
</div>
<
p>
Please fill out your email. A link to reset password will be sent there.
</p
>
<
div
class=
"tab-content"
id=
"myTabContent"
>
<div
class=
"row"
>
<div
class=
"tab-pane fade in active"
id=
"one"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'request-password-reset-form'
]);
?>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'request-password-reset-form'
]);
?>
<?=
$form
->
field
(
$model
,
'telephone'
)
->
textInput
([
'autofocus'
=>
TRUE
])
?>
<div
class=
"tab-pane fade in active"
id=
"one"
>
<div
class=
"reg-box"
>
<div
class=
"phone input-wrapper last-wrapper"
>
<input
name=
"telephone"
type=
"text"
class=
""
placeholder=
"请输入注册的手机号码"
required=
""
autofocus=
""
>
<!--<span class="tips">手机号或者密码错误</span>-->
</div>
<div
style=
"margin-top: 20px;margin-bottom: 20px"
>
<div
style=
"margin-top: 20px;margin-bottom: 20px"
>
<div
id=
"embed-captcha"
></div>
<div
id=
"embed-captcha"
></div>
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
</div>
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Send'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<button
id=
"submit"
class=
"btn btn-log"
type=
"submit"
>
获取验证码
</button>
</div>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
</div>
</div>
</div>
src/frontend/views/site/resetPassword.php
View file @
925760ad
...
@@ -10,23 +10,41 @@ use yii\bootstrap\ActiveForm;
...
@@ -10,23 +10,41 @@ use yii\bootstrap\ActiveForm;
$this
->
title
=
'Reset password'
;
$this
->
title
=
'Reset password'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
?>
<div
class=
"site-reset-password"
>
<div
class=
"z-m-center"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<h3>
找回密码
</h3>
<p>
请按步骤获取密码
</p>
<p>
Please choose your new password:
</p>
<div
id=
"myTab"
class=
"tab-find"
>
<ul>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
1
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
2
</a></li>
<li
class=
"active"
><a
href=
"javascript:;"
data-toggle=
"tab"
>
3
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
4
</a></li>
</ul>
</div>
<div
class=
"row"
>
<div
class=
"tab-content"
id=
"myTabContent"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'reset-password-form'
]);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
([
'autofocus'
=>
TRUE
])
?
>
<div
class=
"tab-pane fade in active"
id=
"three"
>
<?
=
$form
->
field
(
$model
,
'rePassword'
)
->
passwordInput
([
'autofocus'
=>
TRUE
])
?>
<?
php
$form
=
ActiveForm
::
begin
([
'id'
=>
'request-password-reset-form'
]);
?>
<div
class=
"form-group"
>
<div
class=
"reg-box"
>
<?=
Html
::
submitButton
(
'Save'
,
[
'class'
=>
'btn btn-primary'
])
?>
<div
class=
"password input-wrapper"
>
<input
name=
"password"
type=
"password"
class=
""
placeholder=
"设置新密码"
required=
""
>
</div>
</div>
<?php
ActiveForm
::
end
();
?>
<div
class=
"check-password input-wrapper last-wrapper"
>
<input
name=
"rePassword"
type=
"password"
class=
""
placeholder=
"重复输入密码"
required=
""
>
</div>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<button
class=
"btn btn-log"
type=
"submit"
>
确认
</button>
</div>
</div>
<?php
ActiveForm
::
end
()
?>
</div>
</div>
</div>
</div>
src/frontend/views/site/resetPasswordSuccess.php
View file @
925760ad
...
@@ -11,10 +11,38 @@ use yii\helpers\Html;
...
@@ -11,10 +11,38 @@ use yii\helpers\Html;
$this
->
title
=
'密码设置成功'
;
$this
->
title
=
'密码设置成功'
;
?>
?>
<div
class=
"z-m-center"
>
<h3>
找回密码
</h3>
<p>
请按步骤获取密码
</p>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<div
id=
"myTab"
class=
"tab-find"
>
<ul>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
1
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
2
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
3
</a></li>
<li
class=
"active"
><a
href=
"javascript:;"
data-toggle=
"tab"
>
4
</a></li>
</ul>
</div>
<p>
密码设置成功
</p>
<div
class=
"tab-content"
id=
"myTabContent"
>
<?=
Html
::
a
(
'请登录'
,
[
'site/login'
])
?>
<code>
<?=
__FILE__
?>
</code>
<div
class=
"tab-pane fade in active"
id=
"four"
>
<div
class=
"sucess-box"
>
<span><i
class=
"glyphicon glyphicon-ok"
></i></span>
<p>
密码重置成功
</p>
</div>
<div
class=
"foot-reg-btn"
>
<button
class=
"btn btn-reg"
onclick=
"window.location.href='
<?=
\yii\helpers\Url
::
base
()
.
"/site"
?>
'"
type=
"submit"
>
去登录
</button>
</div>
</div>
</div>
</div>
src/frontend/views/site/signup.php
View file @
925760ad
<?php
<?php
/* @var $this yii\web\View */
use
yii\widgets\ActiveForm
;
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \frontend\models\SignupForm */
use
yii\helpers\Html
;
/* @var $this yii\web\View */
use
yii\bootstrap\ActiveForm
;
use
frontend\assets\AppAsset
;
$this
->
title
=
'
Signup
'
;
$this
->
title
=
'
注册
'
;
$
this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$
baseUrl
=
\yii\helpers\Url
::
base
()
;
AppAsset
::
addScript
(
$this
,
'@web/assets/signup.js'
);
\frontend\assets\
AppAsset
::
addScript
(
$this
,
'@web/assets/signup.js'
);
$this
->
registerJsFile
(
'http://static.geetest.com/static/tools/gt.js'
);
$this
->
registerJsFile
(
'http://static.geetest.com/static/tools/gt.js'
);
?>
?>
<div
class=
"site-signup"
>
<div
class=
"z-m-center"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<h3>
云涯
</h3>
<p>
欢迎来到最课堂,专注在线直播
</p>
<div
id=
"myTab"
class=
"tab-a"
>
<ul>
<li><a
href=
"
<?=
$baseUrl
.
"/site/login"
?>
"
data-toggle=
"tab"
>
登录
</a></li>
<li
class=
"active"
><a
href=
"
<?=
$baseUrl
.
"/site/singup"
?>
"
data-toggle=
"tab"
>
注册
</a></li>
</ul>
</div>
<
p>
Please fill out the following fields to signup:
</p
>
<
div
class=
"tab-content"
id=
"myTabContent"
>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'form-signup'
]);
?>
<?=
$form
->
field
(
$model
,
'telephone'
)
->
textInput
([
'autofocus'
=>
TRUE
])
?>
<div
class=
"tab-pane fade in active"
id=
"register"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'form-signup'
]);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<div
class=
"reg-box"
>
<div
class=
"phone input-wrapper"
>
<input
name=
"telephone"
id=
"telephone"
value=
"
<?=
$model
->
telephone
?>
"
type=
"text"
class=
""
placeholder=
"手机号码"
required=
""
autofocus=
""
>
<span
id=
"telephone_tips"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'telephone'
)
?>
</span>
</div>
<?=
$form
->
field
(
$model
,
'rePassword'
)
->
passwordInput
()
?>
<div
class=
"v-code input-wrapper"
>
<input
id=
"token"
name=
"token"
type=
"text"
class=
""
placeholder=
"验证码"
>
<span
id=
"token_tips"
class=
"tips tip-vcode"
>
<?=
$model
->
getFirstError
(
'token'
)
?>
</span>
<button
class=
"btn btn-get-vcode"
id=
"send_msg"
>
获取验证码
</button>
</div>
<div
class=
"password input-wrapper"
>
<input
id=
"password"
name=
"password"
type=
"password"
class=
""
placeholder=
"输入密码"
required=
""
>
<span
id=
"password_tips"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'password'
)
?>
</span>
<label
class=
"control-label"
for=
"token"
>
Token
</label
>
</div
>
<input
name=
"token"
type=
"text"
class=
"form-control"
id=
"token"
>
<div
class=
"check-password input-wrapper last-wrapper"
>
<button
id=
"send_msg"
class=
""
>
send msg
</button>
<input
id=
"repassword"
name=
"rePassword"
type=
"password"
class=
""
placeholder=
"再次输入密码"
required=
""
>
<span
class=
"tips tip-vcode"
>
<?=
$model
->
getFirstError
(
'rePassword'
)
?>
</span>
<span
id=
"repassword_tips"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'rePassword'
)
?>
</span>
</div>
<div
style=
"margin-top: 20px;margin-bottom: 20px"
>
<div
style=
"margin-top: 20px;margin-bottom: 20px"
>
<div
id=
"embed-captcha"
></div>
<div
id=
"embed-captcha"
></div>
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
</div>
</div>
</div>
<div
class=
"form-group
"
>
<div
id=
"submit"
class=
"foot-reg-btn
"
>
<
?=
Html
::
submitButton
(
'Signup'
,
[
'class'
=>
'btn btn-primary'
,
'id'
=>
'signup-button'
])
?
>
<
button
class=
"btn btn-reg"
type=
"submit"
>
注册
</button
>
</div>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
</div>
</div>
</div>
src/frontend/views/site/tokenInput.php
View file @
925760ad
...
@@ -12,23 +12,48 @@ use yii\bootstrap\ActiveForm;
...
@@ -12,23 +12,48 @@ use yii\bootstrap\ActiveForm;
$this
->
title
=
'输入验证码'
;
$this
->
title
=
'输入验证码'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/token_input.js'
);
$this
->
registerJsFile
(
'http://static.geetest.com/static/tools/gt.js'
);
?>
?>
<div
class=
"site-reset-password"
>
<div
class=
"z-m-center"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<h3>
找回密码
</h3>
<p>
请按步骤获取密码
</p>
<div
id=
"myTab"
class=
"tab-find"
>
<ul>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
1
</a></li>
<li
class=
"active"
><a
href=
"javascript:;"
data-toggle=
"tab"
>
2
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
3
</a></li>
<li><a
href=
"javascript:;"
data-toggle=
"tab"
>
4
</a></li>
</ul>
</div>
<
p>
请输入验证码:
</p
>
<
div
class=
"tab-content"
id=
"myTabContent"
>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'token-input-form'
]);
?>
<?=
$form
->
field
(
$model
,
'token'
)
->
passwordInput
([
'autofocus'
=>
TRUE
])
?>
<div
class=
"tab-pane fade in active"
id=
"two"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'token-input-form'
]);
?>
<div
class=
"form-group"
>
<div
class=
"reg-box"
>
<?=
Html
::
submitButton
(
'Save'
,
[
'class'
=>
'btn btn-primary'
])
?>
<div
class=
"phone input-wrapper last-wrapper"
>
<input
name=
"token"
type=
"text"
class=
""
value=
"
<?=
$model
->
token
?>
"
placeholder=
"请输入6位验证码"
required=
""
autofocus=
""
>
<span
class=
"tips"
>
<?=
$model
->
getFirstError
(
'token'
)
?>
</span>
</div>
<div
style=
"margin-top: 20px;margin-bottom: 20px"
>
<div
id=
"embed-captcha"
></div>
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
</div>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<button
id=
"token_input"
class=
"btn btn-log"
type=
"submit"
>
下一步
</button>
</div>
</div>
<?php
ActiveForm
::
end
()
?>
</div>
</div>
</div>
</div>
src/frontend/web/js/site/request_password_reset.js
View file @
925760ad
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
* Created by xiabin on 2016/9/26.
* Created by xiabin on 2016/9/26.
*/
*/
var
handlerEmbed
=
function
(
captchaObj
)
{
var
handlerEmbed
=
function
(
captchaObj
)
{
$
(
"#s
ignup-button
"
).
click
(
function
(
e
)
{
$
(
"#s
ubmit
"
).
click
(
function
(
e
)
{
var
validate
=
captchaObj
.
getValidate
();
var
validate
=
captchaObj
.
getValidate
();
if
(
!
validate
)
{
if
(
!
validate
)
{
$
(
"#notice"
)[
0
].
className
=
"show"
;
$
(
"#notice"
)[
0
].
className
=
"show"
;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$
(
"#notice"
)[
0
].
className
=
"hide"
;
$
(
"#notice"
)[
0
].
className
=
"hide"
;
},
2000
);
},
2000
);
e
.
preventDefault
()
;
return
false
;
}
}
});
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
...
...
src/frontend/web/js/site/signup.js
View file @
925760ad
var
handlerEmbed
=
function
(
captchaObj
)
{
var
handlerEmbed
=
function
(
captchaObj
)
{
$
(
"#s
ignup-button"
).
click
(
function
(
e
)
{
$
(
"#s
ubmit"
).
click
(
function
(
)
{
var
validate
=
captchaObj
.
getValidate
();
var
validate
=
captchaObj
.
getValidate
();
if
(
!
validate
)
{
if
(
!
validate
)
{
$
(
"#notice"
)[
0
].
className
=
"show"
;
$
(
"#notice"
)[
0
].
className
=
"show"
;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$
(
"#notice"
)[
0
].
className
=
"hide"
;
$
(
"#notice"
)[
0
].
className
=
"hide"
;
},
2000
);
},
2000
);
e
.
preventDefault
();
return
false
;
}
var
telephone
=
$
(
"#telephone"
).
val
();
if
(
telephone
.
length
===
0
)
{
$
(
'#telephone_tips'
).
html
(
'手机号码不能为空'
);
return
false
;
}
var
token
=
$
(
"#token"
).
val
();
if
(
token
.
length
===
0
)
{
$
(
'#token_tips'
).
html
(
'验证码不能为空'
);
return
false
;
}
var
password
=
$
(
"#password"
).
val
();
if
(
password
.
length
===
0
)
{
$
(
'#password_tips'
).
html
(
'密码不能为空'
);
return
false
;
}
var
repassword
=
$
(
"#repassword"
).
val
();
if
(
repassword
!==
password
)
{
$
(
'#repassword_tips'
).
html
(
'两次密码输入不一致'
);
return
false
;
}
}
});
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
...
@@ -38,6 +62,7 @@ $.ajax({
...
@@ -38,6 +62,7 @@ $.ajax({
//发送短信呢
//发送短信呢
$
(
'#send_msg'
).
click
(
function
()
{
$
(
'#send_msg'
).
click
(
function
()
{
var
telephone
=
$
(
'#telephone'
).
val
();
var
telephone
=
$
(
'#telephone'
).
val
();
$
.
ajax
({
$
.
ajax
({
// 获取id,challenge,success(是否启用failback)
// 获取id,challenge,success(是否启用failback)
url
:
__BASE_URL__
+
"site/send-signup-msg?telephone="
+
telephone
,
// 加随机数防止缓存
url
:
__BASE_URL__
+
"site/send-signup-msg?telephone="
+
telephone
,
// 加随机数防止缓存
...
@@ -47,7 +72,17 @@ $('#send_msg').click(function () {
...
@@ -47,7 +72,17 @@ $('#send_msg').click(function () {
if
(
data
.
status
===
false
)
{
if
(
data
.
status
===
false
)
{
layer
.
alert
(
data
.
message
,
{
'icon'
:
2
,
'title'
:
'提示'
});
layer
.
alert
(
data
.
message
,
{
'icon'
:
2
,
'title'
:
'提示'
});
}
else
{
}
else
{
layer
.
alert
(
'短信发送成功'
,
{
'icon'
:
1
,
'title'
:
'提示'
})
$
(
"#send_msg"
).
prop
(
'disabled'
,
true
).
html
(
'60秒后重新获取'
);
var
time
=
59
;
var
hander
=
setInterval
(
function
()
{
var
content
=
time
+
'秒后重新获取'
;
time
--
;
$
(
"#send_msg"
).
html
(
content
);
if
(
time
<=
0
)
{
clearInterval
(
hander
)
$
(
"#send_msg"
).
prop
(
'disabled'
,
false
).
html
(
'获取短信验证码'
);
}
},
1000
);
}
}
}
}
}).
error
(
function
()
{
}).
error
(
function
()
{
...
...
src/frontend/web/js/site/token_input.js
0 → 100644
View file @
925760ad
/**
* Created by xiabin on 2016/10/9.
*/
/**
* Created by xiabin on 2016/9/26.
*/
var
handlerEmbed
=
function
(
captchaObj
)
{
$
(
"#token_input"
).
click
(
function
()
{
var
validate
=
captchaObj
.
getValidate
();
if
(
!
validate
)
{
$
(
"#notice"
)[
0
].
className
=
"show"
;
setTimeout
(
function
()
{
$
(
"#notice"
)[
0
].
className
=
"hide"
;
},
2000
);
return
false
;
}
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
captchaObj
.
appendTo
(
"#embed-captcha"
);
captchaObj
.
onReady
(
function
()
{
$
(
"#wait"
)[
0
].
className
=
"hide"
;
});
// 更多接口参考:http://www.geetest.com/install/sections/idx-client-sdk.html
};
$
.
ajax
({
// 获取id,challenge,success(是否启用failback)
url
:
__BASE_URL__
+
"site/start-captcha?type=pc&t="
+
(
new
Date
()).
getTime
(),
// 加随机数防止缓存
type
:
"get"
,
dataType
:
"json"
,
success
:
function
(
data
)
{
// 使用initGeetest接口
// 参数1:配置参数
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
initGeetest
({
gt
:
data
.
gt
,
challenge
:
data
.
challenge
,
product
:
"embed"
,
// 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
offline
:
!
data
.
success
// 表示用户后台检测极验服务器是否宕机,一般不需要关注
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
},
handlerEmbed
);
}
});
src/frontend/web/webpack.config.js
View file @
925760ad
...
@@ -15,6 +15,7 @@ var entry = {
...
@@ -15,6 +15,7 @@ var entry = {
signup
:
[
js_dir
+
'/site/signup.js'
],
signup
:
[
js_dir
+
'/site/signup.js'
],
login
:
[
js_dir
+
'/site/login.js'
],
login
:
[
js_dir
+
'/site/login.js'
],
request_password_reset
:
[
js_dir
+
'/site/request_password_reset'
],
request_password_reset
:
[
js_dir
+
'/site/request_password_reset'
],
token_input
:
[
js_dir
+
'/site/token_input'
],
user_center_info
:
[
js_dir
+
'/user-center/info.js'
],
user_center_info
:
[
js_dir
+
'/user-center/info.js'
],
user_favorite
:
[
js_dir
+
'/user-center/favorite.js'
],
user_favorite
:
[
js_dir
+
'/user-center/favorite.js'
],
user_center_browse_record
:
[
js_dir
+
'/user-center/browse_record.js'
],
user_center_browse_record
:
[
js_dir
+
'/user-center/browse_record.js'
],
...
...
ui/html/注册.html
View file @
925760ad
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
<div
class=
"logo pull-left"
>
云涯 YunYa
</div>
<div
class=
"logo pull-left"
>
云涯 YunYa
</div>
<ul
class=
"nav navbar-nav pull-right yun-login-btn"
>
<ul
class=
"nav navbar-nav pull-right yun-login-btn"
>
<li><a
href=
"#"
>
登录
</a></li>
<li><a
href=
"#"
>
登录
</a></li>
<li
class=
"active"
><a
href=
"
#
"
>
注册
</a></li>
<li
class=
"active"
><a
href=
"
。
"
>
注册
</a></li>
</ul>
</ul>
</nav>
</nav>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment