提交 fa886e16 编写于 作者: T Terry

customer read config from admin config

上级 99766f83
......@@ -32,30 +32,30 @@ return [
'customer_order_info_breadcrumbs' => true,
'customer_product_review_breadcrumbs' => true,
'customer_product_favorite_breadcrumbs' => true,
'register' => [
//'register' => [
// 账号注册成功后,是否自动登录
'successAutoLogin' => true,
//'successAutoLogin' => true,
// 注册登录成功后,跳转的url
'loginSuccessRedirectUrlKey' => 'customer/account',
//'loginSuccessRedirectUrlKey' => 'customer/account',
// 注册页面的验证码是否开启
'registerPageCaptcha' => true,
//'registerPageCaptcha' => true,
],
'login' => [
// ],
//'login' => [
// 在登录页面 customer/account/login 页面登录成功后跳转的urlkey,
'loginPageSuccessRedirectUrlKey' => 'customer/account',
//'loginPageSuccessRedirectUrlKey' => 'customer/account',
// 在其他页面的弹框方式登录的账号成功后,的页面跳转,如果是false,则代表返回原来的页面。
'otherPageSuccessRedirectUrlKey' => false,
//'otherPageSuccessRedirectUrlKey' => false,
// 登录页面的验证码是否开启
'loginPageCaptcha' => false,
// 'loginPageCaptcha' => false,
// 邮件信息,登录账号后是否发送邮件
],
'forgotPassword' => [
//],
//'forgotPassword' => [
// 忘记密码页面的验证码是否开启
'forgotCaptcha' => true,
//'forgotCaptcha' => true,
],
//],
// 在账户中心左侧栏显示的菜单。
'leftMenu' => [
'Account Dashboard' => 'customer/account',
......@@ -67,15 +67,15 @@ return [
],
'contacts' => [
//'contacts' => [
// 联系我们页面的验证码是否开启
'contactsCaptcha' => true,
//'contactsCaptcha' => true,
// 设置联系我们邮箱,如果不设置,则从email service配置中读取。
//'address' => '',
],
'newsletterSubscribe' => [
//],
//'newsletterSubscribe' => [
],
// ],
],
],
];
......@@ -20,8 +20,11 @@ class Forgotpassword
{
public function getLastData()
{
$forgotPasswordParam = \Yii::$app->getModule('customer')->params['forgotPassword'];
$forgotCaptcha = isset($forgotPasswordParam['forgotCaptcha']) ? $forgotPasswordParam['forgotCaptcha'] : false;
$appName = Yii::$service->helper->getAppName();
$forgotCaptcha = Yii::$app->store->get($appName.'_account', 'forgotPasswordCaptcha');
$forgotCaptcha = ($forgotCaptcha == Yii::$app->store->enable) ? true : false;
//$forgotPasswordParam = \Yii::$app->getModule('customer')->params['forgotPassword'];
//$forgotCaptcha = isset($forgotPasswordParam['forgotCaptcha']) ? $forgotPasswordParam['forgotCaptcha'] : false;
$this->breadcrumbs(Yii::$service->page->translate->__('Forgot Password'));
return [
'forgotCaptcha' => $forgotCaptcha,
......@@ -41,8 +44,11 @@ class Forgotpassword
public function sendForgotPasswordMailer($editForm)
{
$captcha = $editForm['captcha'];
$forgotPasswordParam = \Yii::$app->getModule('customer')->params['forgotPassword'];
$forgotCaptcha = isset($forgotPasswordParam['forgotCaptcha']) ? $forgotPasswordParam['forgotCaptcha'] : false;
$appName = Yii::$service->helper->getAppName();
$forgotCaptcha = Yii::$app->store->get($appName.'_account', 'forgotPasswordCaptcha');
$forgotCaptcha = ($forgotCaptcha == Yii::$app->store->enable) ? true : false;
//$forgotPasswordParam = \Yii::$app->getModule('customer')->params['forgotPassword'];
//$forgotCaptcha = isset($forgotPasswordParam['forgotCaptcha']) ? $forgotPasswordParam['forgotCaptcha'] : false;
// 如果开启了验证码,但是验证码验证不正确就报错返回。
if ($forgotCaptcha && !$captcha) {
Yii::$service->page->message->addError(['Captcha can not empty']);
......
......@@ -20,8 +20,11 @@ class Login
{
public function getLastData($param = '')
{
$loginParam = \Yii::$app->getModule('customer')->params['login'];
$loginPageCaptcha = isset($loginParam['loginPageCaptcha']) ? $loginParam['loginPageCaptcha'] : false;
//$loginParam = \Yii::$app->getModule('customer')->params['login'];
$appName = Yii::$service->helper->getAppName();
$loginPageCaptcha = Yii::$app->store->get($appName.'_account', 'loginPageCaptcha');
$loginPageCaptcha = ($loginPageCaptcha == Yii::$app->store->enable) ? true : false;
$email = isset($param['email']) ? $param['email'] : '';
$this->breadcrumbs(Yii::$service->page->translate->__('Login'));
return [
......@@ -45,8 +48,9 @@ class Login
public function login($param)
{
$captcha = $param['captcha'];
$loginParam = \Yii::$app->getModule('customer')->params['login'];
$loginPageCaptcha = isset($loginParam['loginPageCaptcha']) ? $loginParam['loginPageCaptcha'] : false;
$appName = Yii::$service->helper->getAppName();
$loginPageCaptcha = Yii::$app->store->get($appName.'_account', 'loginPageCaptcha');
$loginPageCaptcha = ($loginPageCaptcha == Yii::$app->store->enable) ? true : false;
if ($loginPageCaptcha && !$captcha) {
Yii::$service->page->message->addError(['Captcha can not empty']);
......
......@@ -23,8 +23,8 @@ class Register
$firstname = isset($param['firstname']) ? $param['firstname'] : '';
$lastname = isset($param['lastname']) ? $param['lastname'] : '';
$email = isset($param['email']) ? $param['email'] : '';
$registerParam = \Yii::$app->getModule('customer')->params['register'];
$registerPageCaptcha = isset($registerParam['registerPageCaptcha']) ? $registerParam['registerPageCaptcha'] : false;
$appName = Yii::$service->helper->getAppName();
$registerPageCaptcha = Yii::$app->store->get($appName.'_account', 'registerSuccessAutoLogin');
$this->breadcrumbs(Yii::$service->page->translate->__('Register'));
return [
'firstname' => $firstname,
......@@ -34,7 +34,7 @@ class Register
'maxNameLength' => Yii::$service->customer->getRegisterNameMaxLength(),
'minPassLength' => Yii::$service->customer->getRegisterPassMinLength(),
'maxPassLength' => Yii::$service->customer->getRegisterPassMaxLength(),
'registerPageCaptcha' => $registerPageCaptcha,
'registerPageCaptcha' => ($registerPageCaptcha == Yii::$app->store->enable ? true : false),
];
}
// 面包屑导航
......@@ -50,10 +50,13 @@ class Register
public function register($param)
{
$captcha = $param['captcha'];
$registerParam = \Yii::$app->getModule('customer')->params['register'];
$registerPageCaptcha = isset($registerParam['registerPageCaptcha']) ? $registerParam['registerPageCaptcha'] : false;
$appName = Yii::$service->helper->getAppName();
$registerPageCaptcha = Yii::$app->store->get($appName.'_account', 'registerSuccessAutoLogin');
//$registerParam = \Yii::$app->getModule('customer')->params['register'];
//$registerPageCaptcha = isset($registerParam['registerPageCaptcha']) ? $registerParam['registerPageCaptcha'] : false;
// 如果开启了验证码,但是验证码验证不正确就报错返回。
if ($registerPageCaptcha && !$captcha) {
if (($registerPageCaptcha == Yii::$app->store->enable) && !$captcha) {
Yii::$service->page->message->addError(['Captcha can not empty']);
return;
......
......@@ -21,12 +21,12 @@ class Index
public function getLastData()
{
$contactsEmail = '';
$contactsCaptcha = false;
$contacts = Yii::$app->getModule('customer')->params['contacts'];
if (isset($contacts['contactsCaptcha'])) {
$contactsCaptcha = $contacts['contactsCaptcha'];
}
//$contactsCaptcha = false;
//$contacts = Yii::$app->getModule('customer')->params['contacts'];
$appName = Yii::$service->helper->getAppName();
$contactsCaptcha = Yii::$app->store->get($appName.'_account', 'contactsCaptcha');
$contactsCaptcha = ($contactsCaptcha == Yii::$app->store->enable) ? true : false;
if (isset($contacts['email']['address'])) {
$contactsEmail = $contacts['email']['address'];
}
......@@ -95,9 +95,12 @@ class Index
$captcha = Yii::$app->request->post('sercrity_code');
$captcha = \Yii::$service->helper->htmlEncode($captcha);
$contacts = Yii::$app->getModule('customer')->params['contacts'];
$contactsCaptcha = isset($contacts['contactsCaptcha']) ? $contacts['contactsCaptcha'] : false;
//$contacts = Yii::$app->getModule('customer')->params['contacts'];
//$contactsCaptcha = isset($contacts['contactsCaptcha']) ? $contacts['contactsCaptcha'] : false;
$appName = Yii::$service->helper->getAppName();
$contactsCaptcha = Yii::$app->store->get($appName.'_account', 'contactsCaptcha');
$contactsCaptcha = ($contactsCaptcha == Yii::$app->store->enable) ? true : false;
if ($contactsCaptcha && !$captcha) {
Yii::$service->page->message->addError(['Captcha can not empty']);
......
......@@ -82,21 +82,24 @@ class AccountController extends AppfrontController
$registerStatus = $this->getBlock()->register($param);
//echo $registerStatus;exit;
if ($registerStatus) {
$params_register = Yii::$app->getModule('customer')->params['register'];
// $params_register = Yii::$app->getModule('customer')->params['register'];
$appName = Yii::$service->helper->getAppName();
$registerSuccessAutoLogin = Yii::$app->store->get($appName.'_account', 'registerSuccessAutoLogin');
$registerSuccessRedirectUrlKey = Yii::$app->store->get($appName.'_account', 'registerSuccessRedirectUrlKey');
// 是否需要邮件激活?
if (Yii::$service->email->customer->registerAccountIsNeedEnableByEmail) {
$correctMessage = Yii::$service->page->translate->__("Your account registration is successful, we sent an email to your email, you need to login to your email and click the activation link to activate your account. If you have not received the email, you can resend the email by {url_click_here_before}clicking here{url_click_here_end} {end_text}", ['url_click_here_before' => '<span class="email_register_resend" >', 'url_click_here_end' => '</span>', 'end_text'=> '<span class="resend_text"></span>' ]);
Yii::$service->page->message->AddCorrect($correctMessage);
} else { // 如果不需要邮件激活?
// 注册成功后,是否自动登录
if (isset($params_register['successAutoLogin']) && $params_register['successAutoLogin']) {
if ($registerSuccessAutoLogin == Yii::$app->store->enable) {
Yii::$service->customer->login($param);
}
if (!Yii::$app->user->isGuest) {
// 注册成功后,跳转的页面,如果值为false, 则不跳转。
$urlKey = 'customer/account';
if (isset($params_register['loginSuccessRedirectUrlKey']) && $params_register['loginSuccessRedirectUrlKey']) {
$urlKey = $params_register['loginSuccessRedirectUrlKey'];
if ($registerSuccessRedirectUrlKey) {
$urlKey = $registerSuccessRedirectUrlKey;
}
return Yii::$service->customer->loginSuccessRedirect($urlKey);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册