Browse Source

fix autocomplete on migration

pull/1490/head
Unknwon 10 years ago
parent
commit
c8bb475abb
  1. 12
      modules/bindata/bindata.go
  2. 2
      public/css/gogs.min.css
  3. 9
      public/js/gogs.js
  4. 6
      public/less/_base.less
  5. 3
      routers/repo/repo.go
  6. 3
      templates/repo/migrate.tmpl

12
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

2
public/css/gogs.min.css vendored

File diff suppressed because one or more lines are too long

9
public/js/gogs.js

@ -172,15 +172,6 @@ function initRepository() {
return; return;
} }
// New migrate
if ($('.repository.new.migrate').length > 0) {
// Clear browser autocomplete.
if ($('#auth_username').data('need-clear')) {
$('#auth_username').val('');
$('#auth_password').val('');
}
}
// Labels // Labels
if ($('.repository.labels').length > 0) { if ($('.repository.labels').length > 0) {
// Create label // Create label

6
public/less/_base.less

@ -106,6 +106,12 @@ img {
.avatar.image { .avatar.image {
border-radius: 3px; border-radius: 3px;
} }
.form {
.fake {
display: none!important;
}
}
} }
footer { footer {

3
routers/repo/repo.go

@ -214,7 +214,8 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
} }
} }
if strings.Contains(err.Error(), "Authentication failed") { if strings.Contains(err.Error(), "Authentication failed") ||
strings.Contains(err.Error(), " not found") {
ctx.Data["Err_Auth"] = true ctx.Data["Err_Auth"] = true
ctx.RenderWithErr(ctx.Tr("form.auth_failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form) ctx.RenderWithErr(ctx.Tr("form.auth_failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form)
return return

3
templates/repo/migrate.tmpl

@ -22,8 +22,9 @@
<div class="content {{if .Err_Auth}}active{{end}}"> <div class="content {{if .Err_Auth}}active{{end}}">
<div class="inline field {{if .Err_Auth}}error{{end}}"> <div class="inline field {{if .Err_Auth}}error{{end}}">
<label for="auth_username">{{.i18n.Tr "username"}}</label> <label for="auth_username">{{.i18n.Tr "username"}}</label>
<input id="auth_username" name="auth_username" value="{{.auth_username}}123" {{if not .auth_username}}data-need-clear="true"{{end}}> <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}>
</div> </div>
<input class="fake">
<div class="inline field {{if .Err_Auth}}error{{end}}"> <div class="inline field {{if .Err_Auth}}error{{end}}">
<label for="auth_password">{{.i18n.Tr "password"}}</label> <label for="auth_password">{{.i18n.Tr "password"}}</label>
<input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}">

Loading…
Cancel
Save