Skip to content

Commit

Permalink
Register update, use Telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Oct 13, 2023
1 parent 08db9b8 commit 88f0c96
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 268 deletions.
8 changes: 6 additions & 2 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"helmet": {
"directives": {
"defaultSrc": "'self'",
"childSrc": "'self' www.google.com",
"scriptSrc": "'self' 'unsafe-inline' 'unsafe-eval' www.google.com www.gstatic.com",
"childSrc": "'self' www.google.com telegram.org *.telegram.org",
"scriptSrc": "'self' 'unsafe-inline' 'unsafe-eval' www.google.com www.gstatic.com telegram.org *.telegram.org",
"styleSrc": "'self' 'unsafe-inline' fonts.googleapis.com",
"imgSrc": "* data:",
"fontSrc": "data: fonts.gstatic.com",
Expand Down Expand Up @@ -69,6 +69,10 @@
"enabled": true,
"key": "9e9787bd59204b95812bc7e438939616",
"secret": "ca10592646784980a11179cc72146344"
},
"telegram": {
"enabled": true,
"bot_token": "6390290192:AAEGipeCa4P0V4HZzoXvITCij8on6OItsGM"
}
},
"default_client": "blogs",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"passport-facebook": "^3.0.0",
"passport-mail": "^1.0.1",
"passport-mailru-email": "^1.1.3",
"passport-telegram-official": "^2.0.1",
"passport-vk": "^1.0.0",
"passport-yandex": "^0.0.5",
"querystring": "^0.2.1",
Expand All @@ -37,6 +38,7 @@
"react-foundation-components": "git+https://github.com/golos-blockchain/react-foundation-components.git#5dbfb800aff45988c57bb7d09c1c235a8b49b418",
"react-google-recaptcha": "^2.1.0",
"react-intl": "^5.25.1",
"react-telegram-login": "^1.1.2",
"secure-random": "^1.1.1",
"simple-jsonrpc-js": "^1.2.0",
"styled-components": "^5.3.3",
Expand Down
10 changes: 5 additions & 5 deletions src/elements/register/VerifyWayTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class VerifyWayTabs extends React.Component {

const path = this.getPath()

let email = tt('verify_way_tabs_jsx.email')
if (currentWay === 'email') {
email = <span>{email}</span>
let social = tt('verify_way_tabs_jsx.social')
if (currentWay === 'social') {
social = <span>{social}</span>
} else {
email = <Link href={path}>{email}</Link>
social = <Link href={path}>{social}</Link>
}

let invite = tt('verify_way_tabs_jsx.invite_code')
Expand All @@ -43,7 +43,7 @@ class VerifyWayTabs extends React.Component {
}

return <div style={{ marginBottom: '1.0rem' }}>
{email}
{social}
&nbsp;|&nbsp;
{invite}
&nbsp;|&nbsp;
Expand Down
11 changes: 9 additions & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"enter_invite_code": "Enter invite code",
"enter_invite_code_optional": "You also can use invite code, if you have it:",
"or_use_socsite": "...or use social site",
"or_use_telegram": "...or use your Telegram account",
"invite_secret_cannot_be_empty": "Invite code cannot be empty",
"invite_new_account_will_receive": "Account will have %(amount)s in Golos Power",
"enter_account_name": "Enter your account name",
Expand Down Expand Up @@ -67,7 +68,13 @@
"phone_number_has_been_verified": "E-mail has been verified, please continue the registration.",
"authorizing_with": "Authorizing with ",
"authorized_with_": "Аuthorized with ",
"email_exceed": "Currently limit of free registration is exceed. You can use invite or transfer."
"email_exceed": "Currently limit of free registration is exceed. You can use invite or transfer.",
"free_remain": "",
"free_remain2": {
"zero": "0 free registrations remain.",
"one": "1 free registration remains.",
"other": "%(count)s free registrations remain."
}
},
"transfer_register_jsx": {
"please_send_transfer": "Please send at least ",
Expand Down Expand Up @@ -302,7 +309,7 @@
"frozen3": "this form."
},
"verify_way_tabs_jsx": {
"email": "With Gmail",
"social": "Social",
"invite_code": "Invite-code",
"transfer": "Transfer"
},
Expand Down
11 changes: 9 additions & 2 deletions src/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"enter_invite_code": "Введите ваш инвайт-код",
"enter_invite_code_optional": "Вы также можете использовать инвайт-код, если он у вас есть:",
"or_use_socsite": "...или авторизуйтесь через свой аккаунт",
"or_use_telegram": "...или авторизуйтесь через свой аккаунт Telegram",
"invite_secret_cannot_be_empty": "Инвайт-код не может быть пустым",
"invite_new_account_will_receive": "Созданный аккаунт получит %(amount)s в Силу Голоса",
"enter_account_name": "Введите имя пользователя",
Expand Down Expand Up @@ -67,7 +68,13 @@
"phone_number_has_been_verified": "Спасибо, ваша почта подтверждена. Пожалуйста, продолжите регистрацию.",
"authorizing_with": "Идет авторизация с помощью ",
"authorized_with_": "Авторизовано с помощью ",
"email_exceed": "На сегодня исчерпан лимит бесплатных регистраций. Можно зарегистрироваться с помощью инвайт-кода или перевода с биржи."
"email_exceed": "На сегодня исчерпан лимит бесплатных регистраций. Можно зарегистрироваться с помощью инвайт-кода или перевода с биржи.",
"free_remain": "Осталось ",
"free_remain2": {
"zero": "0 бесплатных регистраций.",
"one": "1 бесплатная регистрация.",
"other": "%(count)s бесплатных регистраций."
}
},
"transfer_register_jsx": {
"please_send_transfer": "Пожалуйста, отправьте перевод не менее ",
Expand Down Expand Up @@ -302,7 +309,7 @@
"frozen3": "этой формой."
},
"verify_way_tabs_jsx": {
"email": "Gmail-почта",
"social": "Соцсети",
"invite_code": "Инвайт-код",
"transfer": "Перевод с биржи"
},
Expand Down
5 changes: 3 additions & 2 deletions src/pages/api/reg/[...all].js
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,11 @@ let handler = nextConnect({ attachParams: true, })
verification_way: 'social-undefined',
step: (soc_id_type && !soc_error) ? 'verified' : 'sending',
}
if (!soc_id) {
if (!soc_id && soc_error) {
const se = soc_error
delete req.session.soc_error // To do not prevent another tries
await req.session.save()
throwErr(req, soc_error.status, [soc_error.message], soc_error.exception, state)
throwErr(req, se.status, [se.message], se.exception, state)
}
state.status = 'ok'
res.json({
Expand Down
6 changes: 6 additions & 0 deletions src/pages/api/reg/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ let handler = nextConnect()
throwErr(req, 403, ['daily_reg_limit_exceed'], null, state)
}

if (req.session.soc_id) {
delete req.session.soc_id
delete req.session.soc_id_type
await req.session.save()
}

console.log('-- /submit creating account');

const delegation = config.get('registrar.delegation')
Expand Down
Loading

0 comments on commit 88f0c96

Please sign in to comment.