Skip to content

Commit 6a1ec7b

Browse files
committed
Merge branch 'drepo-refine-user-registration' into 'master'
Drepo refine user registration See merge request persper/gitlab-ce!46
2 parents 3ff983b + 5a044fe commit 6a1ec7b

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

config/gitlab.yml.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,11 @@ production: &base
795795
http_api: 'https://ipfs.infura.io:5001'
796796
storage_path: 'tmp/ipfs'
797797

798+
## Uncomment the following to enable Drepo username registration
799+
# drepo:
800+
# need_check_username: true
801+
802+
798803
development:
799804
<<: *base
800805

drepo/app/assets/javascripts/drepo_users/components/check_username.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
import Icon from '~/vue_shared/components/icon.vue';
124124
import { mapGetters, mapState } from 'vuex';
125125
import axios from 'axios';
126-
import contractInfo from '../contract';
126+
import contractInfo from '../../drepo_contract';
127127
128128
export default {
129129
name: 'CheckUsername',

drepo/app/controllers/drepo_users_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def verified
1313
signature = params[:signature]
1414

1515
if [username, message, signature].any? { |x| x.blank? }
16-
@user.errors[:base] << "some param is invalid."
16+
flash[:alert] = "some param is invalid."
1717
return
1818
end
1919

2020
is_equal, address = verify_signature(username, message, signature)
2121
unless is_equal
22-
@user.errors[:base] << "Unmatch signature. Verify failure."
22+
flash[:alert] = "Unmatch signature. Verify failure."
2323
return
2424
end
2525

@@ -77,7 +77,7 @@ def address_possess_this_username(username, address)
7777
client = Ethereum::HttpClient.new('https://rinkeby.infura.io/v3/8d1ba1e9ef484906ba94d560cc1d3a87')
7878
client.default_account = private_key.address
7979

80-
contract_file_path = Rails.root.join('drepo/app/assets/javascripts/drepo_users/contract/central.json').to_s
80+
contract_file_path = Rails.root.join('drepo/app/assets/javascripts/drepo_contract/central.json').to_s
8181
contract_address, abi = parse_contract_file(contract_file_path)
8282

8383
contract = Ethereum::Contract.create(name: 'Central', client: client, abi: abi, address: contract_address)

drepo/app/views/drepo_users/check_username.html.haml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88
.row.prepend-top-default
99
.col-lg-3.profile-settings-sidebar
1010
%p
11-
- group_docs_path = help_page_path('user/group/index')
12-
- group_docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: group_docs_path }
13-
= s_('%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects.').html_safe % { group_docs_link_start: group_docs_link_start, group_docs_link_end: '</a>'.html_safe }
11+
= _('You need register a username used in both local GitLab client and remote Drepo smart contract, which could be served by Merico officially or any third parties. Your username is identical and valuable in a Drepo service.')
1412
%p
15-
- subgroup_docs_path = help_page_path('user/group/subgroups/index')
16-
- subgroup_docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: subgroup_docs_path }
17-
= s_('Groups can also be nested by creating %{subgroup_docs_link_start}subgroups%{subgroup_docs_link_end}.').html_safe % { subgroup_docs_link_start: subgroup_docs_link_start, subgroup_docs_link_end: '</a>'.html_safe }
13+
= _('To create a username you need: at first input a username to verify if it had been registered by others. If so you can choose another one until it is available. Then you can register it. After registration succeeds, you need to activate it by signing a message and complete registration. ')
1814
%p
19-
= _('Projects that belong to a group are prefixed with the group namespace. Existing projects may be moved into a group.')
15+
= _('To make a transition in Ethereum costs at least a few minutes or more. So if you don\'t like to wait when registering, you can leave and come back later to reregister it again. It can tell if it\'s your current Ethereum account registered the username. If so you can bind/activate it to current GitLab account and complete registration.')
2016

2117
.col-lg-9
2218
#check-username-form

0 commit comments

Comments
 (0)