Browse Source

Merge remote-tracking branch 'origin/V20221228' into zouap

pull/3481/head
zouap 2 years ago
parent
commit
48489ac5f9
19 changed files with 493 additions and 181 deletions
  1. +3
    -3
      models/cloudbrain.go
  2. +5
    -1
      options/locale/locale_en-US.ini
  3. +5
    -1
      options/locale/locale_zh-CN.ini
  4. BIN
      public/img/login_bg_default.png
  5. +45
    -0
      routers/api/v1/repo/attachments.go
  6. +1
    -1
      routers/repo/modelarts.go
  7. +14
    -0
      routers/user/auth.go
  8. +35
    -7
      services/cloudbrain/cloudbrainTask/notebook.go
  9. +10
    -0
      templates/base/footer_content.tmpl
  10. +3
    -0
      templates/repo/cloudbrain/show.tmpl
  11. +46
    -4
      templates/user/auth/signin.tmpl
  12. +43
    -4
      templates/user/auth/signin_cloud_brain.tmpl
  13. +1
    -1
      templates/user/auth/signin_navbar.tmpl
  14. +97
    -59
      templates/user/auth/signin_phone.tmpl
  15. +45
    -0
      templates/user/auth/signin_up_img_default.tmpl
  16. +136
    -97
      templates/user/auth/signup_inner.tmpl
  17. +1
    -1
      web_src/js/components/EditAboutInfo.vue
  18. +1
    -1
      web_src/less/openi.less
  19. +2
    -1
      web_src/vuepages/pages/notebook/debug/index.vue

+ 3
- 3
models/cloudbrain.go View File

@@ -180,14 +180,14 @@ type Cloudbrain struct {
AiCenter string //grampus ai center: center_id+center_name

TrainUrl string //输出模型的obs路径
BranchName string //分支名称
BranchName string `xorm:"varchar(2550)"` //分支名称
Parameters string //传给modelarts的param参数
BootFile string //启动文件
BootFile string `xorm:"varchar(2550)"` //启动文件
DataUrl string `xorm:"varchar(3500)"` //数据集的obs路径
LogUrl string //日志输出的obs路径
PreVersionId int64 //父版本的版本id
FlavorCode string //modelarts上的规格id
Description string `xorm:"varchar(256)"` //描述
Description string `xorm:"varchar(2550)"` //描述
WorkServerNumber int //节点数
FlavorName string //规格名称
EngineName string //引擎名称


+ 5
- 1
options/locale/locale_en-US.ini View File

@@ -406,6 +406,8 @@ sspi_auth_failed = SSPI authentication failed
change_email = Change email
change_email_address = Change email address
new_email_address = New email address
openi_community_really_awesome = OpenI, Really Awesome!

[phone]
format_err=The format of phone number is wrong.
query_err=Fail to query phone number, please try again later.
@@ -1061,6 +1063,8 @@ model_rename=Duplicate model name, please modify model name.

notebook_file_not_exist=Notebook file does not exist.
notebook_select_wrong=Please select a Notebook(.ipynb) file first.
notebook_path_too_long=The total length of selected file or files path exceed 255 characters, please select a shorter path file or change the file path.
notebook_branch_name_too_long=The total length of branch or branches name exceed 255 characters, please select a file in other branch.
notebook_file_no_right=You have no right to access the Notebook(.ipynb) file.
notebook_repo_conflict=The files in different branches of the same repository can not run together.
debug_again_fail=Fail to restart debug task, please try again later.
@@ -1481,7 +1485,7 @@ blame = Blame
normal_view = Normal View
line = line
lines = lines
notebook_open = Open in Notebook
notebook_open = Run Online

editor.new_file = New File
editor.upload_file = Upload File


+ 5
- 1
options/locale/locale_zh-CN.ini View File

@@ -409,6 +409,8 @@ sspi_auth_failed=SSPI 认证失败
change_email=修改邮箱
change_email_address=修改邮箱地址
new_email_address=新邮箱地址
openi_community_really_awesome=启智社区 确实给力

[phone]
format_err=手机号格式错误。
query_err=查询手机号失败,请稍后再试。
@@ -1060,6 +1062,8 @@ model_rename=模型名称重复,请修改模型名称

notebook_file_not_exist=Notebook文件不存在。
notebook_select_wrong=请先选择Notebook(.ipynb)文件。
notebook_path_too_long=选择的一个或多个Notebook文件路径总长度超过255个字符,请选择路径较短的文件或调整文件路径。
notebook_branch_name_too_long=选择的一个或多个Notebook文件分支名总长度超过255个字符,请选择其他分支的文件。
notebook_file_no_right=您没有这个Notebook文件的读权限。
notebook_repo_conflict=同一个仓库的不同分支文件不能同时运行。
debug_again_fail=再次调试失败,请稍后再试。
@@ -1499,7 +1503,7 @@ normal_view=普通视图
line=行
lines=行

notebook_open = 在Notebook中打开
notebook_open = 在线运行

editor.new_file=新建文件
editor.upload_file=上传文件


BIN
public/img/login_bg_default.png View File

Before After
Width: 1200  |  Height: 938  |  Size: 142 kB

+ 45
- 0
routers/api/v1/repo/attachments.go View File

@@ -1,22 +1,67 @@
package repo

import (
"net/http"

"code.gitea.io/gitea/modules/log"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
routeRepo "code.gitea.io/gitea/routers/repo"
)

func GetSuccessChunks(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}

routeRepo.GetSuccessChunks(ctx.Context)
}

func checkDatasetPermission(ctx *context.APIContext) string {
datasetId := ctx.QueryInt64("dataset_id")

dataset, err := models.GetDatasetByID(datasetId)
if err != nil {
log.Warn("can not find dataset", err)

return "dataset.query_dataset_fail"
}
repo, err := models.GetRepositoryByID(dataset.RepoID)
if err != nil {
log.Warn("can not find repo", err)
return "dataset.query_dataset_fail"
}

permission, err := models.GetUserRepoPermission(repo, ctx.User)
if err != nil {
log.Warn("can not find repo permission for user", err)
return "dataset.query_dataset_fail"
}
if !permission.CanWrite(models.UnitTypeDatasets) {

return "error.no_right"
}
return ""
}

func NewMultipart(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}
routeRepo.NewMultipart(ctx.Context)
}
func GetMultipartUploadUrl(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}
routeRepo.GetMultipartUploadUrl(ctx.Context)
}

func CompleteMultipart(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}
routeRepo.CompleteMultipart(ctx.Context)

}


+ 1
- 1
routers/repo/modelarts.go View File

@@ -483,7 +483,7 @@ func getFileUrl(url string, filename string) string {
}
}

return url + middle + filename
return url + middle + filename + "?reset"
}

func NotebookRestart(ctx *context.Context) {


+ 14
- 0
routers/user/auth.go View File

@@ -36,6 +36,7 @@ import (
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/externalaccount"
"code.gitea.io/gitea/services/mailer"
"code.gitea.io/gitea/services/repository"

"gitea.com/macaron/captcha"
"github.com/markbates/goth"
@@ -145,6 +146,11 @@ func checkAutoLogin(ctx *context.Context) bool {
return false
}

func getActivityTpl() string {
result, _ := repository.RecommendContentFromPromote(setting.RecommentRepoAddr + "/signin/activity_tpl")
return result
}

// SignIn render sign in page
func SignIn(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("sign_in")
@@ -168,6 +174,7 @@ func SignIn(ctx *context.Context) {
ctx.Data["PageIsLogin"] = true
ctx.Data["EnableSSPI"] = models.IsSSPIEnabled()
ctx.Data["EnableCloudBrain"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()

ctx.HTML(200, tplSignIn)
}
@@ -185,6 +192,7 @@ func SignInCloudBrain(ctx *context.Context) {
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsCloudBrainLogin"] = true
ctx.Data["EnableCloudBrain"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()

ctx.HTML(200, tplSignInCloudBrain)
}
@@ -197,6 +205,7 @@ func SignInPhone(ctx *context.Context) {
}

ctx.Data["PageIsPhoneLogin"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()

ctx.HTML(200, tplSignInPhone)
}
@@ -206,6 +215,7 @@ func SignInPhonePost(ctx *context.Context, form auth.PhoneNumberCodeForm) {
ctx.Data["PageIsPhoneLogin"] = true
ctx.Data["IsCourse"] = ctx.QueryBool("course")
ctx.Data["EnableCloudBrain"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()

if ctx.HasError() {
ctx.HTML(200, tplSignInPhone)
@@ -356,6 +366,7 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) {
func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) {
ctx.Data["PageIsCloudBrainLogin"] = true
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login/cloud_brain"
ctx.Data["ActivityTpl"] = getActivityTpl()
SignInPostCommon(ctx, form)
}

@@ -363,6 +374,7 @@ func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) {
func SignInPost(ctx *context.Context, form auth.SignInForm) {
ctx.Data["PageIsLogin"] = true
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login"
ctx.Data["ActivityTpl"] = getActivityTpl()
SignInPostCommon(ctx, form)
}

@@ -1257,6 +1269,7 @@ func SignUp(ctx *context.Context) {

//Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration
ctx.Data["ActivityTpl"] = getActivityTpl()

ctx.HTML(200, tplSignUp)
}
@@ -1272,6 +1285,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
ctx.Data["CaptchaType"] = setting.Service.CaptchaType
ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
ctx.Data["PageIsSignUp"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()

//Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
if setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration {


+ 35
- 7
services/cloudbrain/cloudbrainTask/notebook.go View File

@@ -35,6 +35,7 @@ const NoteBookExtension = ".ipynb"
const CPUType = 0
const GPUType = 1
const NPUType = 2
const CharacterLength = 2550

func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOption) {

@@ -46,6 +47,14 @@ func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOp
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_select_wrong")))
return
}
if len(getBootFile(option.File, option.OwnerName, option.ProjectName)) > CharacterLength {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_path_too_long")))
return
}
if len(option.BranchName) > CharacterLength {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_branch_name_too_long")))
return
}

isNotebookFileExist, _ := isNoteBookFileExist(ctx, option)
if !isNotebookFileExist {
@@ -105,14 +114,29 @@ func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOp
err = downloadCode(sourceRepo, getCodePath(noteBook.JobName, sourceRepo), option.BranchName)
if err != nil {
log.Error("download code failed", err)
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("cloudbrain.load_code_failed")))
return
if !strings.Contains(err.Error(), "already exists and is not an empty directory") {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("cloudbrain.load_code_failed")))
return
}
}
}
if !isRepoFileMatch(option, noteBook) {
noteBook.BootFile += ";" + getBootFile(option.File, option.OwnerName, option.ProjectName)
noteBook.BranchName += ";" + option.BranchName
noteBook.Description += ";" + getDescription(option)
if len(noteBook.BootFile)+len(getBootFile(option.File, option.OwnerName, option.ProjectName))+1 <= CharacterLength {
noteBook.BootFile += ";" + getBootFile(option.File, option.OwnerName, option.ProjectName)
} else {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_path_too_long")))
return
}
if len(noteBook.BranchName)+len(option.BranchName)+1 <= CharacterLength {
noteBook.BranchName += ";" + option.BranchName
} else {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_branch_name_too_long")))
return
}

if len(noteBook.Description)+len(getDescription(option))+1 <= CharacterLength {
noteBook.Description += ";" + getDescription(option)
}

err := models.UpdateJob(noteBook)
if err != nil {
@@ -417,7 +441,7 @@ func cloudBrainFileNoteBookCreate(ctx *context.Context, option api.CreateFileNot
}

func getCloudbrainType(optionType int) int {
if optionType < 1 {
if optionType <= GPUType {
return models.TypeCloudBrainOne
}
if setting.ModelartsCD.Enabled {
@@ -431,7 +455,11 @@ func getCodePath(jobName string, repo *models.Repository) string {
}

func getDescription(option api.CreateFileNotebookJobOption) string {
return option.OwnerName + "/" + option.ProjectName + "/" + option.File
des := option.OwnerName + "/" + option.ProjectName + "/" + option.File
if len(des) <= CharacterLength {
return des
}
return ""
}

func modelartsFileNoteBookCreate(ctx *context.Context, option api.CreateFileNotebookJobOption, repo *models.Repository, sourceRepo *models.Repository) {


+ 10
- 0
templates/base/footer_content.tmpl View File

@@ -1,3 +1,13 @@
<style>
@media only screen and (max-width: 767px) {
.mobile-text-align-center {
text-align: center !important;
}
.mobile-justify-content-center {
justify-content: center !important;
}
}
</style>
<footer style="border-top:none;">
<div class="ui container">
<div class="ui grid">


+ 3
- 0
templates/repo/cloudbrain/show.tmpl View File

@@ -111,7 +111,9 @@
<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-code">
{{.BranchName}}
{{if not .BootFile}}
<span style="margin-left:1rem" class="ui label">{{SubStr .CommitID 0 10}}</span>
{{end}}
</div>
</td>
</tr>
@@ -376,6 +378,7 @@
{{template "base/footer" .}}
<script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
<script>
$('.menu .item').tab()
$(document).ready(function () {
$('.ui.accordion').accordion({ selector: { trigger: '.icon' } });


+ 46
- 4
templates/user/auth/signin.tmpl View File

@@ -1,9 +1,51 @@
{{template "base/head" .}}
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<script>
var ActivityTpl = {{ .ActivityTpl }};
</script>
<div class="user signin{{if .LinkAccountMode}} icon{{end}}">
{{template "user/auth/signin_navbar" .}}
<div class="ui container">
<div class="ui raised very padded text container segment">
{{template "user/auth/signin_inner" .}}
<div class="ui container" style="margin-top:60px;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
{{template "user/auth/signin_navbar" .}}
{{template "user/auth/signin_inner" .}}
</div>
</div>
</div>
</div>
</div>


+ 43
- 4
templates/user/auth/signin_cloud_brain.tmpl View File

@@ -1,9 +1,48 @@
{{template "base/head" .}}
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<div class="user signin">
{{template "user/auth/signin_navbar" .}}
<div class="ui container">
<div class="ui raised very padded text container segment">
{{template "user/auth/signin_cloudbrain" .}}
<div class="ui container" style="margin-top:60px;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
{{template "user/auth/signin_navbar" .}}
{{template "user/auth/signin_cloudbrain" .}}
</div>
</div>
</div>
</div>
</div>


+ 1
- 1
templates/user/auth/signin_navbar.tmpl View File

@@ -1,5 +1,5 @@
{{if or .EnablePhone .EnableOpenIDSignIn .EnableSSPI .EnableCloudBrain}}
<div class="ui secondary pointing tabular top attached borderless menu new-menu navbar">
<div class="ui secondary pointing tabular top attached borderless menu new-menu navbar" style="margin-bottom:45px !important;background-color:transparent !important;">
{{if .EnablePhone }}
<a class="{{if .PageIsPhoneLogin}}active{{end}} item" rel="nofollow" href="{{AppSubUrl}}/user/login/phone">
{{.i18n.Tr "phone.mobile_login"}}


+ 97
- 59
templates/user/auth/signin_phone.tmpl View File

@@ -1,73 +1,111 @@
{{template "base/head" .}}
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<div class="user signin">
{{template "user/auth/signin_navbar" .}}
<div class="ui container">
<div class="ui raised very padded text container segment">
<style>
.full.height{background-color: #F9F9F9;}
.ui.left:not(.action){ float:none;}
.ui.left{ float:none;}
.ui.secondary.pointing.menu{ border-bottom:none;}
</style>
{{template "base/alert" .}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signin_title"}}
{{else}}
{{.i18n.Tr "auth.login_userpass"}}
{{end}}
</h2>
</div>
{{if .ShowRegistrationButton}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
</div>
{{end}}
<div class="ui container" style="margin-top:60px;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="/user/login/phone" method="post">
{{.CsrfTokenHtml}}

{{if .EnablePhone }}
<div class="use-type" usetype="1" autofocus="true">
{{template "user/auth/phone_verify" .}}
</div>
{{end}}

<div class="two fields inline">
<div class="field">
<div class="ui checkbox">
<label>{{.i18n.Tr "auth.remember_me"}}</label>
<input name="remember" type="checkbox">
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
<style>
.full.height{background-color: #F9F9F9;}
.ui.left:not(.action){ float:none;}
.ui.left{ float:none;}
.ui.secondary.pointing.menu{ border-bottom:none;}
</style>
{{template "user/auth/signin_navbar" .}}
{{template "base/alert" .}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signin_title"}}
{{else}}
{{.i18n.Tr "auth.login_userpass"}}
{{end}}
</h2>
</div>
{{if .ShowRegistrationButton}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
</div>
{{end}}
</div>
<div class="field" style="padding-right: 0; text-align: right;">
<a href="{{AppSubUrl}}/user/forgot_password?type=phone">{{.i18n.Tr "auth.forgot_password"}}</a>
</div>
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="/user/login/phone" method="post">
{{.CsrfTokenHtml}}

{{if .EnablePhone }}
<div class="use-type" usetype="1" autofocus="true">
{{template "user/auth/phone_verify" .}}
</div>
{{end}}

<div class="ui hidden divider"></div>
<div class="two fields inline">
<div class="field">
<div class="ui checkbox">
<label>{{.i18n.Tr "auth.remember_me"}}</label>
<input name="remember" type="checkbox">
</div>
</div>
<div class="field" style="padding-right: 0; text-align: right;">
<a href="{{AppSubUrl}}/user/forgot_password?type=phone">{{.i18n.Tr "auth.forgot_password"}}</a>
</div>
</div>

<div class="center aligned field">
<button class="fluid large ui blue button">
{{.i18n.Tr "sign_in"}}
</button>
<div class="ui hidden divider"></div>

<div class="center aligned field">
<button class="fluid large ui blue button">
{{.i18n.Tr "sign_in"}}
</button>
</div>
</form>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

</div>
</div>
</div>
</div>
{{template "base/footer" .}}

+ 45
- 0
templates/user/auth/signin_up_img_default.tmpl View File

@@ -0,0 +1,45 @@
<div style="width:100%;height:100%;
border-radius: 0.28571429rem;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 40px;
background: url('/img/login_bg_default.png') center center no-repeat;
background-size: cover;
border-right:none !important;
">
<div style="margin: 14px 0;">
<span style="font-weight:500;font-size:28px;color:rgb(0, 122, 255);">{{.i18n.Tr "auth.openi_community_really_awesome"}}</span>
</div>
<div style="margin: 14px 0;">
<span style="font-weight:300;font-size:14px;color:rgb(140, 162, 170);">{{.i18n.Tr "home.page_description"}}</span>
</div>
<div style="margin: 14px 0;">
<div style="width:111px">
<a href="https://openi.pcl.ac.cn/zeizei/OpenI_Learning">
<div style="
width: 111px;
height: 40px;
font-size: 14px;
border-color: rgb(0, 122, 255);
border-width: 1px;
border-style: solid;
color: rgb(0, 122, 255);
display:flex;
align-items: center;
justify-content: center;
">
<svg xmlns="http://www.w3.org/2000/svg" style="margin-right:8px;margin-top:-2px;" class="styles__StyledSVGIconPathComponent-sc-16fsqc8-0 fPsHiw svg-icon-path-icon fill" viewBox="0 0 32 32" width="16" height="16"><defs data-reactroot=""></defs><g><path fill="rgb(0, 122, 255)" d="M2.667 5.324c0.005-0.729 0.594-1.318 1.322-1.324h24.022c0.731 0 1.323 0.593 1.323 1.324v21.352c-0.005 0.729-0.594 1.318-1.322 1.324h-24.022c-0.731-0.001-1.323-0.593-1.323-1.324v0-21.352zM14.667 6.667h-9.333v18.667h9.333v-18.667zM17.333 6.667v18.667h9.333v-18.667h-9.333zM18.667 9.333h6.667v2.667h-6.667v-2.667zM18.667 13.333h6.667v2.667h-6.667v-2.667z"></path></g></svg>
<span>{{.i18n.Tr "custom.Platform_Tutorial"}}</span>
</div>
</a>
</div>
</div>
</div>



+ 136
- 97
templates/user/auth/signup_inner.tmpl View File

@@ -1,112 +1,151 @@
<style>
.full.height{background-color: #F9F9F9;}
</style>

<div class="ui container very padded {{if .LinkAccountMode}} icon{{end}}" style=" padding-top: 5.0rem; padding-bottom: 3.0rem;">
<div class="ui raised very padded text container segment">
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_title"}}
{{else}}
{{.i18n.Tr "sign_up"}}
{{end}}
</h2>
</div>
{{if not .LinkAccountMode}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/login">{{.i18n.Tr "auth.register_helper_msg"}}</a>
</div>
{{end}}
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="{{.SignUpLink}}" method="post">
{{.CsrfTokenHtml}}
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
{{template "base/alert" .}}
{{end}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
{{if .DisableRegistration}}
<p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
{{else}}
<div class="field invitation_tips" style="font-weight:400;font-size:14px;color:rgba(250,140,22,1);{{if not .invitationCode}}display:none;{{end}}">
<span>{{.i18n.Tr "your_friend"}} <span class="__invitation_code__">{{.invitationCode}}</span> {{.i18n.Tr "invite_you_to_join_the_OpenI_AI_Collaboration_Platform_and_enjoy_abundant_free_computing_resources"}}</span>
</div>
<div class="field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "username"}}" autofocus required>
</div>
<div class="field {{if .Err_Email}}error{{end}}">
<input id="email" name="email" type="email" value="{{.email}}" placeholder="{{.i18n.Tr "email"}}" required>
</div>

{{if not .DisablePassword}}
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
</div>
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="retype" name="retype" type="password" value="{{.retype}}" placeholder="{{.i18n.Tr "re_type"}}" autocomplete="off" required>
</div>
{{end}}
{{if and .EnableCaptcha (eq .CaptchaType "image")}}
<div class="field">
{{.Captcha.CreateHtml}}
</div>
<div class="field {{if .Err_Captcha}}error{{end}}">
<input id="captcha" name="captcha" value="{{.captcha}}" placeholder="{{.i18n.Tr "captcha"}}" autocomplete="off">
</div>
{{end}}
{{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
<div class="field required">
<div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
</div>
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<div class="ui container very padded {{if .LinkAccountMode}} icon{{end}}" style=" padding-top: 5.0rem; padding-bottom: 3.0rem;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_title"}}
{{else}}
{{.i18n.Tr "sign_up"}}
{{end}}
{{if .EnablePhone }}
<div class="use-type" usetype="0">
{{template "user/auth/phone_verify" .}}
</h2>
</div>
{{if not .LinkAccountMode}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/login">{{.i18n.Tr "auth.register_helper_msg"}}</a>
</div>
{{end}}
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="{{.SignUpLink}}" method="post">
{{.CsrfTokenHtml}}
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
{{template "base/alert" .}}
{{end}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
{{end}}
<div class="field">
<div style="display:flex;">
<div style="display:flex;align-items:center;">
<span>{{.i18n.Tr "recommender"}}</span>
{{if .DisableRegistration}}
<p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
{{else}}
<div class="field invitation_tips" style="font-weight:400;font-size:14px;color:rgba(250,140,22,1);{{if not .invitationCode}}display:none;{{end}}">
<span>{{.i18n.Tr "your_friend"}} <span class="__invitation_code__">{{.invitationCode}}</span> {{.i18n.Tr "invite_you_to_join_the_OpenI_AI_Collaboration_Platform_and_enjoy_abundant_free_computing_resources"}}</span>
</div>
<div class="field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "username"}}" autofocus required>
</div>
<div class="field {{if .Err_Email}}error{{end}}">
<input id="email" name="email" type="email" value="{{.email}}" placeholder="{{.i18n.Tr "email"}}" required>
</div>
<input style="flex:1;margin-left:12px;" id="invitation_code" name="invitation_code" value="{{.invitationCode}}" {{if .invitationCode}}readonly="true"{{end}} autocomplete="off" />
</div>
</div>

<div class="field">
<div class="ui checkbox">
<input name="agree" type="checkbox" tabindex="0" class="hidden" {{if .agree}}checked{{end}}><label>{{.i18n.Tr "use_and_privacy_agree" "/home/term" "/home/privacy" | Safe}}</label>
</div>
</div>
<div class="ui hidden divider"></div>
<div class="center aligned field">
<button class="fluid large ui blue button">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_submit"}}
{{else}}
{{.i18n.Tr "auth.create_new_account"}}
{{if not .DisablePassword}}
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
</div>
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="retype" name="retype" type="password" value="{{.retype}}" placeholder="{{.i18n.Tr "re_type"}}" autocomplete="off" required>
</div>
{{end}}
</button>
</div>
{{end}}
</form>
</div>
{{if and .EnableCaptcha (eq .CaptchaType "image")}}
<div class="field">
{{.Captcha.CreateHtml}}
</div>
<div class="field {{if .Err_Captcha}}error{{end}}">
<input id="captcha" name="captcha" value="{{.captcha}}" placeholder="{{.i18n.Tr "captcha"}}" autocomplete="off">
</div>
{{end}}
{{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
<div class="field required">
<div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
</div>
{{end}}
{{if .EnablePhone }}
<div class="use-type" usetype="0">
{{template "user/auth/phone_verify" .}}
</div>
{{end}}
<div class="field">
<div style="display:flex;">
<div style="display:flex;align-items:center;">
<span>{{.i18n.Tr "recommender"}}</span>
</div>
<input style="flex:1;margin-left:12px;" id="invitation_code" name="invitation_code" value="{{.invitationCode}}" {{if .invitationCode}}readonly="true"{{end}} autocomplete="off" />
</div>
</div>

<div class="field">
<div class="ui checkbox">
<input name="agree" type="checkbox" tabindex="0" class="hidden" {{if .agree}}checked{{end}}><label>{{.i18n.Tr "use_and_privacy_agree" "/home/term" "/home/privacy" | Safe}}</label>
</div>
</div>
<div class="ui hidden divider"></div>
<div class="center aligned field">
<button class="fluid large ui blue button">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_submit"}}
{{else}}
{{.i18n.Tr "auth.create_new_account"}}
{{end}}
</button>
</div>
{{end}}
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<script>
; (function() {
var getUrlParams = function() {


+ 1
- 1
web_src/js/components/EditAboutInfo.vue View File

@@ -53,8 +53,8 @@ export default {
index_web: '',
repo_name_name: '',
alias:'',
IsPermit:false
},
IsPermit: false,
// rule1:[{min:3,max:5,message:'1',trigger:"blur"}],
rule: {
index_web: [


+ 1
- 1
web_src/less/openi.less View File

@@ -1455,7 +1455,7 @@ i.SUCCEEDED {
white-space: nowrap;
}
.text-span-new {
width: 800px;
overflow: hidden;
text-overflow: ellipsis;
height: 20%;


+ 2
- 1
web_src/vuepages/pages/notebook/debug/index.vue View File

@@ -375,7 +375,7 @@ export default {
location.href=`${AppSubUrl}/authentication/wechat/bind`
}
if(err.response.status===401){
location.href=`${AppSubUrl}/user/login?redirect_to=${location.origin}${location.pathname}?type=login`
location.href=`${AppSubUrl}/user/login?redirect_to=${encodeURIComponent(location.origin+location.pathname + '?type=login&card='+ this.selectIndex)}`
return
}
this.btnStatus[index]=0
@@ -445,6 +445,7 @@ export default {
if(new URLSearchParams(window.location.search).get("type")==='login'){
that.getNotebookInfo()
that.dialogVisible = true;
that.selectIndex = Number(new URLSearchParams(window.location.search).get("card"))
}
document
.querySelector("#notebook-debug")


Loading…
Cancel
Save