Skip to content

Commit

Permalink
Revert "feature: 支持密码重置可选择短信验证方式 #631 (#849)"
Browse files Browse the repository at this point in the history
This reverts commit 7ef6234.
  • Loading branch information
wklken authored Dec 16, 2022
1 parent 7ef6234 commit 41f10b4
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 424 deletions.
2 changes: 0 additions & 2 deletions src/pages/src/common/demand-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
bkProgress,
bkRadio,
bkRadioGroup,
bkRadioButton,
bkRoundProgress,
bkRow,
bkSearchSelect,
Expand Down Expand Up @@ -101,7 +100,6 @@ Vue.use(bkProcess);
Vue.use(bkProgress);
Vue.use(bkRadio);
Vue.use(bkRadioGroup);
Vue.use(bkRadioButton);
Vue.use(bkRoundProgress);
Vue.use(bkRow);
Vue.use(bkSearchSelect);
Expand Down
6 changes: 0 additions & 6 deletions src/pages/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,7 @@ export default {
数字: 'number',
'特殊字符(除空格)': 'Special characters (except spaces)',
'请输入账户绑定的邮箱,我们将为您发送密码重置邮件': 'Please enter your account bound email address and we will send you a password reset email',
'请输入账号信息,我们将为您发送重置密码短信': 'Please enter your account information, and we will send you a message to reset your password',
'请输入用户名/手机号': 'Please enter username or mobile number',
发送验证码: 'Send verification code',
请输入验证码: 'Please enter the verification code',
请输入邮箱: 'Please enter email address',
: 'after',
重新发送: 'Resend',
'邮箱格式错误,请重新输入': 'Mailbox format error, please re - enter',
发送密码重置邮件: 'Send a password reset message',
已发送密码重置邮件: 'A password reset message has been sent',
Expand Down
6 changes: 0 additions & 6 deletions src/pages/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@ export default {
数字: '数字',
'特殊字符(除空格)': '特殊字符(除空格)',
'请输入账户绑定的邮箱,我们将为您发送密码重置邮件': '请输入账户绑定的邮箱,我们将为您发送密码重置邮件',
'请输入账号信息,我们将为您发送重置密码短信': '请输入账号信息,我们将为您发送重置密码短信',
'请输入用户名/手机号': '请输入用户名/手机号',
发送验证码: '发送验证码',
请输入验证码: '请输入验证码',
: '后',
重新发送: '重新发送',
请输入邮箱: '请输入邮箱',
'邮箱格式错误,请重新输入': ' 邮箱格式错误,请重新输入',
发送密码重置邮件: '发送密码重置邮件',
Expand Down
8 changes: 0 additions & 8 deletions src/pages/src/store/modules/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,5 @@ export default {
reset(context, params, config = {}) {
return http.post('api/v1/web/passwords/reset/send_email/', params);
},
// 获取短信验证码
sendSms(context, params, config = {}) {
return http.post('api/v1/web/passwords/reset/verification_code/send_sms/', params);
},
// 发送验证码
sendCode(context, params, config = {}) {
return http.post('api/v1/web/passwords/reset/verification_code/verify/', params);
},
},
};
151 changes: 0 additions & 151 deletions src/pages/src/views/password/Email.vue

This file was deleted.

145 changes: 122 additions & 23 deletions src/pages/src/views/password/Reset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,71 @@
<div class="login-heard">
<img src="../../images/svg/logo_cn.svg" alt="蓝鲸智云" width="160">
</div>
<div class="login-methond" v-if="!hasReset">
<bk-radio-group class="fr" v-model="checkMethod">
<bk-radio-button value="sms">
{{$t('短信')}}
</bk-radio-button>
<bk-radio-button value="email">
{{$t('邮箱')}}
</bk-radio-button>
</bk-radio-group>
<div class="login-content">
<div class="reset-pw">
<div class="reset-content" v-if="hasReset === false">
<h4 class="common-title">{{$t('重置密码')}}</h4>
<p :class="['text', { 'show-error-info': isError }]">{{$t('请输入账户绑定的邮箱,我们将为您发送密码重置邮件')}}</p>
<p class="error-text" v-if="isError">
<i class="icon icon-user-exclamation-circle-shape"></i>
<span class="text">{{$t('邮箱格式错误,请重新输入')}}</span>
</p>
<input
type="text"
:class="['select-text', { 'input-error': isError }]"
:placeholder="$t('请输入邮箱')"
v-model="resetEmail"
@focus="hiddenError" />
<bk-button
theme="primary" class="submit"
:disabled="!resetEmail" @click="submitEmailPw">{{$t('发送密码重置邮件')}}</bk-button>
</div>
</div>
<div class="reset-content" v-if="hasReset === true">
<h4 class="common-title">{{$t('已发送密码重置邮件')}}</h4>
<p class="text" style="margin: 0 0 18px 0">{{$t('已发送至您的邮箱')}}:{{resetEmail}}<br />{{$t('请查看邮件并根据提示进行操作')}}</p>
<bk-button theme="primary" class="submit" @click="goEmail">{{$t('前往邮箱')}}</bk-button>
</div>
</div>
<reset-email v-if="checkMethod === 'email'" @has-reset="hasReset = true"></reset-email>
<reset-sms v-if="checkMethod === 'sms'"></reset-sms>
</div>
</div>
</template>

<script>
import ResetEmail from './Email.vue';
import ResetSms from './Sms.vue';

export default {
name: 'ResetPassword',
components: {
'reset-email': ResetEmail,
'reset-sms': ResetSms,
},
data() {
return {
checkMethod: 'sms',
isError: false,
resetEmail: '',
hasReset: false,
};
},
methods: {
hiddenError() {
this.isError = false;
},
async submitEmailPw() {
try {
// eslint-disable-next-line no-useless-escape
const reEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if (!reEmail.test(this.resetEmail)) {
this.isError = true;
return;
}
// 调用接口
const emailParams = { email: this.resetEmail };
await this.$store.dispatch('password/reset', emailParams);
this.hasReset = true;
} catch (e) {
console.warn(e);
}
},
goEmail() {
const emailUrl = this.resetEmail.split('@')[1];
window.open(`https://mail.${emailUrl}`);
},
},
};
</script>

Expand Down Expand Up @@ -105,9 +138,75 @@ export default {
}
}

.login-methond {
position: absolute;
right: 24px;
top: 120px;
.login-content {
padding: 0 24px;
font-size: 14px;
}

.common-title {
margin: 20px 0 6px 0;
font-size: 20px;
font-weight: 400;
color: rgba(49, 50, 56, 1);
line-height: 28px;
}

.select-text {
padding-left: 12px;

&::input-placeholder {
color: rgba(195, 205, 215, 1);
}
}

.submit {
width: 100%;
}
// 重置密码
.reset-content {
.text {
font-size: 14px;
font-weight: 400;
color: rgba(99, 101, 110, 1);
line-height: 20px;
margin: 10px 0 20px;

&.show-error-info {
margin-bottom: 10px;
}
}

.select-text {
margin-bottom: 20px;
}
}
// 错误提示
.error-text {
margin-bottom: 10px;
color: #ea3636;
font-size: 14px;

.text {
color: #ea3636;
}

.icon {
color: #ea3636;
}
}

/*.logo-title {
width: 100%;
height: 110px;
border-bottom: 1px solid #F0F1F5;
border-radius: 2px 2px 0 0;
background: #fff;
text-align: center;
line-height: 110px;
img {
height: 35px;
vertical-align: top;
margin-top: 37px;
}
}*/
</style>
Loading

0 comments on commit 41f10b4

Please sign in to comment.