|
|
|
@@ -39,15 +39,14 @@ |
|
|
|
# business :boolean default("0") |
|
|
|
# profile_completed :boolean default("0") |
|
|
|
# laboratory_id :integer |
|
|
|
# is_shixun_marker :boolean default("0") |
|
|
|
# admin_visitable :boolean default("0") |
|
|
|
# collaborator :boolean default("0") |
|
|
|
# platform :string(255) default("0") |
|
|
|
# gitea_token :string(255) |
|
|
|
# gitea_uid :integer |
|
|
|
# is_shixun_marker :boolean default("0") |
|
|
|
# is_sync_pwd :boolean default("1") |
|
|
|
# watchers_count :integer default("0") |
|
|
|
# devops_step :integer default("0") |
|
|
|
# gitea_token :string(255) |
|
|
|
# platform :string(255) |
|
|
|
# sign_cla :boolean default("0") |
|
|
|
# |
|
|
|
# Indexes |
|
|
|
# |
|
|
|
@@ -56,8 +55,7 @@ |
|
|
|
# index_users_on_homepage_teacher (homepage_teacher) |
|
|
|
# index_users_on_laboratory_id (laboratory_id) |
|
|
|
# index_users_on_login (login) UNIQUE |
|
|
|
# index_users_on_mail (mail) UNIQUE |
|
|
|
# index_users_on_phone (phone) UNIQUE |
|
|
|
# index_users_on_mail (mail) |
|
|
|
# index_users_on_type (type) |
|
|
|
# |
|
|
|
|
|
|
|
@@ -463,6 +461,23 @@ class User < Owner |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def register_gitea |
|
|
|
psd = "12345678" |
|
|
|
interactor = Gitea::RegisterInteractor.call({username: self.login, email: self.mail, password: psd}) |
|
|
|
if interactor.success? |
|
|
|
gitea_user = interactor.result |
|
|
|
result = Gitea::User::GenerateTokenService.call(self.login, psd) |
|
|
|
self.gitea_token = result['sha1'] |
|
|
|
self.gitea_uid = gitea_user[:body]['id'] |
|
|
|
self.password = psd |
|
|
|
self.password_confirmation = psd |
|
|
|
if self.save! |
|
|
|
UserExtension.create!(user_id: self.id) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def activate! |
|
|
|
update_attribute(:status, STATUS_ACTIVE) |
|
|
|
prohibit_gitea_user_login!(false) |
|
|
|
|