mirror of
https://github.com/wassname/talk.git
synced 2026-07-28 11:27:05 +08:00
Merge master
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: talk-plugin-auth
|
||||
permalink: /plugin/talk-plugin-auth/
|
||||
layout: plugin
|
||||
plugin:
|
||||
name: talk-plugin-auth
|
||||
default: true
|
||||
provides:
|
||||
- Client
|
||||
---
|
||||
|
||||
This provides the base plugin that is the basis for all auth based plugins that
|
||||
utilize our internal authentication system.
|
||||
|
||||
To sync Talk auth with your own auth systems, you can use this plugin as a
|
||||
template.
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Slot } from 'plugin-api/beta/client/components';
|
||||
import {
|
||||
Button,
|
||||
TextField,
|
||||
@@ -28,6 +29,15 @@ class SignUp extends React.Component {
|
||||
this.props.onSubmit();
|
||||
};
|
||||
|
||||
childFactory = el => {
|
||||
const key = el.key;
|
||||
const props = {
|
||||
indicateBlocker: () => this.props.indicateBlocker(key),
|
||||
indicateBlockerResolved: () => this.props.indicateBlockerResolved(key),
|
||||
};
|
||||
return React.cloneElement(el, props);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
username,
|
||||
@@ -42,6 +52,7 @@ class SignUp extends React.Component {
|
||||
errorMessage,
|
||||
requireEmailConfirmation,
|
||||
success,
|
||||
blocked,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@@ -103,6 +114,10 @@ class SignUp extends React.Component {
|
||||
onChange={this.handlePasswordRepeatChange}
|
||||
minLength="8"
|
||||
/>
|
||||
<Slot
|
||||
fill="talkPluginAuth.formField"
|
||||
childFactory={this.childFactory}
|
||||
/>
|
||||
<div className={styles.action}>
|
||||
<Button
|
||||
type="submit"
|
||||
@@ -110,6 +125,7 @@ class SignUp extends React.Component {
|
||||
id="coralSignUpButton"
|
||||
className={styles.button}
|
||||
full
|
||||
disabled={blocked}
|
||||
>
|
||||
{t('talk-plugin-auth.login.sign_up')}
|
||||
</Button>
|
||||
@@ -161,6 +177,9 @@ SignUp.propTypes = {
|
||||
errorMessage: PropTypes.string,
|
||||
requireEmailConfirmation: PropTypes.bool.isRequired,
|
||||
success: PropTypes.bool.isRequired,
|
||||
blocked: PropTypes.bool.isRequired,
|
||||
indicateBlocker: PropTypes.func.isRequired,
|
||||
indicateBlockerResolved: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default SignUp;
|
||||
|
||||
@@ -16,8 +16,19 @@ class SignUpContainer extends Component {
|
||||
emailError: null,
|
||||
passwordError: null,
|
||||
passwordRepeatError: null,
|
||||
blockers: [],
|
||||
};
|
||||
|
||||
indicateBlocker = key =>
|
||||
this.setState(state => ({
|
||||
blockers: state.blockers.concat(key),
|
||||
}));
|
||||
|
||||
indicateBlockerResolved = key =>
|
||||
this.setState(state => ({
|
||||
blockers: state.blockers.filter(i => i !== key),
|
||||
}));
|
||||
|
||||
validate = data => {
|
||||
let valid = true;
|
||||
const changes = {};
|
||||
@@ -48,7 +59,7 @@ class SignUpContainer extends Component {
|
||||
passwordRepeat: this.state.passwordRepeat,
|
||||
};
|
||||
|
||||
if (this.validate(data)) {
|
||||
if (this.validate(data) && !this.state.blockers.length) {
|
||||
this.props.signUp(data);
|
||||
}
|
||||
};
|
||||
@@ -76,6 +87,9 @@ class SignUpContainer extends Component {
|
||||
render() {
|
||||
return (
|
||||
<SignUp
|
||||
indicateBlocker={this.indicateBlocker}
|
||||
indicateBlockerResolved={this.indicateBlockerResolved}
|
||||
blocked={!!this.state.blockers.length}
|
||||
onSubmit={this.handleSubmit}
|
||||
onUsernameChange={this.setUsername}
|
||||
onEmailChange={this.props.setEmail}
|
||||
|
||||
@@ -1,3 +1,48 @@
|
||||
ar:
|
||||
talk-plugin-auth:
|
||||
login:
|
||||
email_verify_cta: "يرجى التحقق من عنوان البريد الإلكتروني الخاص بك."
|
||||
request_new_verify_email: "طلب بريد إلكتروني آخر"
|
||||
verify_email: "شكرا لك على إنشاء حساب جديد! لقد أرسلنا رسالة إلكترونية إلى البريد الإلكتروني الذي قدمته للتحقق من حسابك."
|
||||
verify_email2: "يجب إثبات ملكية حسابك قبل التفاعل مع المجموعة."
|
||||
not_you: "ليس انت؟"
|
||||
logged_in_as: "تسجيل الدخول ك"
|
||||
facebook_sign_in: "تسجيل الدخول باستخدام الفيسبوك"
|
||||
facebook_sign_up: "اشترك عبر حساب فايسبوك"
|
||||
logout: "خروج"
|
||||
sign_in: "تسجيل الدخول"
|
||||
sign_in_to_join: "سجل الدخول للانضمام إلى المحادثة"
|
||||
or: "أو"
|
||||
email: "البريد الإلكتروني"
|
||||
password: "كلمة المرور"
|
||||
forgot_your_pass: "نسيت كلمة المرور؟"
|
||||
need_an_account: "تحتاج الى حساب؟"
|
||||
register: "تسجيل"
|
||||
sign_up: "سجل"
|
||||
confirm_password: "تأكيد كلمة المرور"
|
||||
username: "اسم المستخدم"
|
||||
already_have_an_account: "هل لديك حساب؟"
|
||||
recover_password: "إستعادة كلمة المرور"
|
||||
email_in_use: "البريد الالكتروني قيد الاستخدام"
|
||||
email_or_username_in_use: "البريد الإلكتروني أو اسم المستخدم قيد الاستخدام"
|
||||
required_field: "هذه الخانة مطلوبه"
|
||||
passwords_dont_match: "كلمات المرور غير متطابقة."
|
||||
special_characters: "يمكن أن تحتوي أسماء المستخدمين على أحرف وأرقام و _ فقط"
|
||||
sign_in_to_comment: "تسجيل الدخول للتعليق"
|
||||
check_the_form: "استمارة غير صالحة. يرجى التحقق من الحقول"
|
||||
set_username_dialog:
|
||||
check_the_form: "استمارة غير صالحة. يرجى التحقق من الحقول"
|
||||
continue: "تابع بنفس اسم المستخدم الخاص بفيسبوك"
|
||||
error_create: "حدث خطأ أثناء تغيير اسم المستخدم"
|
||||
fake_comment_body: "هذا مثال للتعليق. يمكن للقراء تبادل الأفكار والآراء مع غرف الأخبار في قسم التعليقات."
|
||||
fake_comment_date: "منذ دقيقة"
|
||||
if_you_dont_change_your_name: "إذا لم تقم بتغيير اسم المستخدم الخاص بك في هذه الخطوة سوف يظهر اسم المستخدم الخاص بفيسبوك جنبا إلى جنب مع كل تعليقاتك."
|
||||
required_field: "حقل مطلوب"
|
||||
save: حفظ
|
||||
special_characters: "يمكن أن تحتوي أسماء المستخدمين على أحرف, أرقام و _ فقط"
|
||||
username: اسم المستخدم
|
||||
write_your_username: "عدل اسم المستخدم"
|
||||
your_username: "يظهر اسم المستخدم في كل تعليق تنشره."
|
||||
da:
|
||||
talk-plugin-auth:
|
||||
login:
|
||||
|
||||
Reference in New Issue
Block a user