Browse Source

finish all new user settings UI

pull/1629/head
Unknwon 9 years ago
parent
commit
52ec80fa18
  1. 5
      cmd/web.go
  2. 31
      conf/locale/locale_de-DE.ini
  3. 4
      conf/locale/locale_en-US.ini
  4. 73
      conf/locale/locale_lv-LV.ini
  5. 41
      conf/locale/locale_zh-CN.ini
  6. 2
      gogs.go
  7. 2
      models/issue.go
  8. 2
      models/models.go
  9. 2
      models/repo.go
  10. 2
      models/token.go
  11. 20
      models/user.go
  12. 2
      modules/auth/user_form.go
  13. 16
      modules/bindata/bindata.go
  14. 2
      public/css/gogs.min.css
  15. 3
      public/less/_base.less
  16. 11
      public/less/_user.less
  17. 127
      routers/user/setting.go
  18. 2
      templates/.VERSION
  19. 94
      templates/user/settings/email.tmpl
  20. 59
      templates/user/settings/password.tmpl

5
cmd/web.go

@ -267,8 +267,9 @@ func runWeb(ctx *cli.Context) {
m.Get("", user.Settings) m.Get("", user.Settings)
m.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost) m.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost)
m.Post("/avatar", binding.MultipartForm(auth.UploadAvatarForm{}), user.SettingsAvatar) m.Post("/avatar", binding.MultipartForm(auth.UploadAvatarForm{}), user.SettingsAvatar)
m.Get("/email", user.SettingsEmails) m.Combo("/email").Get(user.SettingsEmails).
m.Post("/email", bindIgnErr(auth.AddEmailForm{}), user.SettingsEmailPost) Post(bindIgnErr(auth.AddEmailForm{}), user.SettingsEmailPost)
m.Post("/email/delete", user.DeleteEmail)
m.Get("/password", user.SettingsPassword) m.Get("/password", user.SettingsPassword)
m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost) m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
m.Combo("/ssh").Get(user.SettingsSSHKeys). m.Combo("/ssh").Get(user.SettingsSSHKeys).

31
conf/locale/locale_de-DE.ini

@ -241,7 +241,7 @@ location=Standort
update_profile=Profil aktualisieren update_profile=Profil aktualisieren
update_profile_success=Profil aktualisiert update_profile_success=Profil aktualisiert
change_username=Benutzername geändert change_username=Benutzername geändert
change_username_desc=Benutzername wurde geändert, möchtest du fortfahren? Dies beeinträchtigt sämtliche Links, die dein Konto betreffen. change_username_prompt=Diese Änderung wird sich auf die Linkbezüge zu deinem Account auswirken.
continue=Weiter continue=Weiter
cancel=Abbrechen cancel=Abbrechen
@ -256,6 +256,7 @@ update_avatar_success=Deine Avatar-Einstellung wurde aktualisiert.
change_password=Passwort ändern change_password=Passwort ändern
old_password=Aktuelles Passwort old_password=Aktuelles Passwort
new_password=Neues Passwort new_password=Neues Passwort
retype_new_password=Retype New Password
password_incorrect=Aktuelles Passwort ist nicht korrekt. password_incorrect=Aktuelles Passwort ist nicht korrekt.
change_password_success=Passwort geändert. Du kannst dich jetzt mit dem neuen Passwort anmelden. change_password_success=Passwort geändert. Du kannst dich jetzt mit dem neuen Passwort anmelden.
@ -265,6 +266,9 @@ email_desc=Deine primäre E-Mail-Adresse wird für Benachrichtigungen und andere
primary=Primär primary=Primär
primary_email=Als primäre Adresse verwenden primary_email=Als primäre Adresse verwenden
delete_email=Löschen delete_email=Löschen
email_deletion=E-mail Deletion
email_deletion_desc=Delete this e-mail address will remove related information from your account. Do you want to continue?
email_deletion_success=E-mail has been deleted successfully!
add_new_email=Neue E-Mail-Adresse hinzufügen add_new_email=Neue E-Mail-Adresse hinzufügen
add_email=E-Mail-Adresse hinzufügen add_email=E-Mail-Adresse hinzufügen
add_email_confirmation_sent=Eine neue Bestätigungsmail wurde an <b>%s</b> gesendet, bitte überprüfen Sie Ihren Posteingang innerhalb von %d Stunden um die Bestätigung abzuschließen. add_email_confirmation_sent=Eine neue Bestätigungsmail wurde an <b>%s</b> gesendet, bitte überprüfen Sie Ihren Posteingang innerhalb von %d Stunden um die Bestätigung abzuschließen.
@ -516,7 +520,7 @@ settings.githooks=Git-Hooks
settings.basic_settings=Grundeinstellungen settings.basic_settings=Grundeinstellungen
settings.danger_zone=Gefahrenzone settings.danger_zone=Gefahrenzone
settings.site=Offizielle Webseite settings.site=Offizielle Webseite
settings.update_settings=Aktualisierungseinstellungen settings.update_settings=Einstellungen speichern
settings.change_reponame_prompt=Diese Änderung wirkt sich darauf aus, wie sich Links auf das Repository beziehen. settings.change_reponame_prompt=Diese Änderung wirkt sich darauf aus, wie sich Links auf das Repository beziehen.
settings.transfer=Besitz übertragen settings.transfer=Besitz übertragen
settings.transfer_desc=Übertrage dieses Repository einem anderen Benutzer oder einer Organisation in der du Admin-Rechte hast. settings.transfer_desc=Übertrage dieses Repository einem anderen Benutzer oder einer Organisation in der du Admin-Rechte hast.
@ -630,7 +634,6 @@ release.tag_name_already_exist=Ein Release mit diesem Tag existiert bereits.
[org] [org]
org_name_holder=Name der Organisation org_name_holder=Name der Organisation
org_name_helper=Gute Namen von Organisationen sind kurz und einprägsam. org_name_helper=Gute Namen von Organisationen sind kurz und einprägsam.
org_email_helper=Die E-Mail-Adresse der Organisation erhält alle Benachrichtigungen und Bestätigungs-E-Mails.
create_org=Organisation erstellen create_org=Organisation erstellen
repo_updated=Aktualisiert repo_updated=Aktualisiert
people=Personen people=Personen
@ -654,10 +657,10 @@ settings.options=Optionen
settings.full_name=Vollständiger Name settings.full_name=Vollständiger Name
settings.website=Webseite settings.website=Webseite
settings.location=Standort settings.location=Standort
settings.update_settings=Aktualisierungseinstellungen settings.update_settings=Einstellungen speichern
settings.change_orgname=Organisationsname geändert
settings.change_orgname_desc=Organisationsname wurde geändert, möchtest du fortfahren? Dies beeinträchtigt sämtliche Links, die diese Organisation betreffen.
settings.update_setting_success=Organisationseinstellungen aktualisiert settings.update_setting_success=Organisationseinstellungen aktualisiert
settings.change_orgname_prompt=Diese Änderung wird sich auf die Linkbezüge zur Organisation auswirken.
settings.update_avatar_success=Avatareinstellung für die Organisation wurde erfolgreich aktualisiert.
settings.delete=Organisation löschen settings.delete=Organisation löschen
settings.delete_account=Diese Organisation löschen settings.delete_account=Diese Organisation löschen
settings.delete_prompt=Die Organisation wird dauerhaft gelöscht. Dies kann <strong>NICHT</strong> rückgängig gemacht werden! settings.delete_prompt=Die Organisation wird dauerhaft gelöscht. Dies kann <strong>NICHT</strong> rückgängig gemacht werden!
@ -774,9 +777,9 @@ users.admin=Admin
users.repos=Repositorys users.repos=Repositorys
users.created=Erzeugt users.created=Erzeugt
users.edit=Bearbeiten users.edit=Bearbeiten
users.auth_source=Auth-Quelle users.auth_source=Authentifizierungsquelle
users.local=Lokal users.local=Lokal
users.auth_login_name=Auth-Login-Name users.auth_login_name=Authentifizierung-Loginnname
users.update_profile_success=Kontoprofil aktualisiert users.update_profile_success=Kontoprofil aktualisiert
users.edit_account=Konto bearbeiten users.edit_account=Konto bearbeiten
users.is_activated=Dieses Konto ist aktiviert users.is_activated=Dieses Konto ist aktiviert
@ -800,7 +803,7 @@ repos.watches=Beobachtungen
repos.stars=Markierungen repos.stars=Markierungen
repos.issues=Issues repos.issues=Issues
auths.auth_manage_panel=Authentifizierung auths.auth_manage_panel=Verwaltungspanel für die Authentifizierung
auths.new=Neue Authentifizierungsquelle hinzufügen auths.new=Neue Authentifizierungsquelle hinzufügen
auths.name=Name auths.name=Name
auths.type=Typ auths.type=Typ
@ -820,7 +823,7 @@ auths.attribute_mail=E-Mail Attribut
auths.filter=Benutzernamen Filter auths.filter=Benutzernamen Filter
auths.admin_filter=Admin Filter auths.admin_filter=Admin Filter
auths.ms_ad_sa=Ms Ad SA auths.ms_ad_sa=Ms Ad SA
auths.smtp_auth=SMTP-Authentifizierungstyp auths.smtp_auth=SMTP Authentifizierungstyp
auths.smtphost=SMTP-Host auths.smtphost=SMTP-Host
auths.smtpport=SMTP-Port auths.smtpport=SMTP-Port
auths.enable_tls=TLS-Verschlüsselung aktivieren auths.enable_tls=TLS-Verschlüsselung aktivieren
@ -830,11 +833,11 @@ auths.enable_auto_register=Automatische Registrierung aktivieren
auths.tips=Tipps auths.tips=Tipps
auths.edit=Authentifizierungseinstellungen bearbeiten auths.edit=Authentifizierungseinstellungen bearbeiten
auths.activated=Diese Authentifizierung ist aktiviert auths.activated=Diese Authentifizierung ist aktiviert
auths.update_success=Authentifizierungseinstellungen aktualisiert auths.update_success=Die Authentifizierungseinstellungen wurden erfolgreich aktualisiert.
auths.update=Authentifizierungseinstellungen aktualisieren auths.update=Authentifizierungseinstellungen aktualisieren
auths.delete=Authentifizierung löschen auths.delete=Diese Authentifizierung löschen
auths.delete_auth_title=Authentifizierungsquelle löschen auths.delete_auth_title=Löschen der Authentifizierung
auths.delete_auth_desc=Diese Authentifizierungsquelle wird gelöscht, möchtest du fortfahren? auths.delete_auth_desc=Diese Authentifizierung wird gelöscht, möchtest du fortfahren?
config.server_config=Server-Konfiguration config.server_config=Server-Konfiguration
config.app_name=Anwendungsname config.app_name=Anwendungsname

4
conf/locale/locale_en-US.ini

@ -256,6 +256,7 @@ update_avatar_success = Your avatar setting has been updated successfully.
change_password = Change Password change_password = Change Password
old_password = Current Password old_password = Current Password
new_password = New Password new_password = New Password
retype_new_password = Retype New Password
password_incorrect = Current password is not correct. password_incorrect = Current password is not correct.
change_password_success = Your password was successfully changed. You can now sign using this new password. change_password_success = Your password was successfully changed. You can now sign using this new password.
@ -265,6 +266,9 @@ email_desc = Your primary e-mail address will be used for notifications and othe
primary = Primary primary = Primary
primary_email = Set as primary primary_email = Set as primary
delete_email = Delete delete_email = Delete
email_deletion = E-mail Deletion
email_deletion_desc = Delete this e-mail address will remove related information from your account. Do you want to continue?
email_deletion_success = E-mail has been deleted successfully!
add_new_email = Add new e-mail address add_new_email = Add new e-mail address
add_email = Add e-mail add_email = Add e-mail
add_email_confirmation_sent = A new confirmation e-mail has been sent to <b>%s</b>, please check your inbox within the next %d hours to complete the confirmation process. add_email_confirmation_sent = A new confirmation e-mail has been sent to <b>%s</b>, please check your inbox within the next %d hours to complete the confirmation process.

73
conf/locale/locale_lv-LV.ini

@ -241,7 +241,7 @@ location=Atrašanās vieta
update_profile=Mainīt profilu update_profile=Mainīt profilu
update_profile_success=Jūsu profila dati ir veiksmīgi saglabāti. update_profile_success=Jūsu profila dati ir veiksmīgi saglabāti.
change_username=Lietotāja vārds mainīts change_username=Lietotāja vārds mainīts
change_username_desc=Lietotājvārds tiks mainīts, vai vēlaties turpināt? Tas ietekmēs visas saites, kas attiecas uz Jūsu kontu. change_username_prompt=This change will affect the way how links relate to your account.
continue=Turpināt continue=Turpināt
cancel=Atcelt cancel=Atcelt
@ -256,6 +256,7 @@ update_avatar_success=Jūsu profila bilde tika veiksmīgi saglabāta.
change_password=Mainīt paroli change_password=Mainīt paroli
old_password=Pašreizējā parole old_password=Pašreizējā parole
new_password=Jauna parole new_password=Jauna parole
retype_new_password=Retype New Password
password_incorrect=Ievadīta nepareiza pašreizējā parole. password_incorrect=Ievadīta nepareiza pašreizējā parole.
change_password_success=Parole tika veiksmīgi nomainīta. Tagad jūs varat pieraksītites, izmantojot jauno paroli. change_password_success=Parole tika veiksmīgi nomainīta. Tagad jūs varat pieraksītites, izmantojot jauno paroli.
@ -265,6 +266,9 @@ email_desc=Primārā e-pasta adrese tiks izmantota sūtot notifikācijas un cit
primary=Primārā primary=Primārā
primary_email=Iestatīt kā primāro primary_email=Iestatīt kā primāro
delete_email=Dzēst delete_email=Dzēst
email_deletion=E-mail Deletion
email_deletion_desc=Delete this e-mail address will remove related information from your account. Do you want to continue?
email_deletion_success=E-mail has been deleted successfully!
add_new_email=Pievienot jaunu e-pasta adresi add_new_email=Pievienot jaunu e-pasta adresi
add_email=Pievienot e-pastu add_email=Pievienot e-pastu
add_email_confirmation_sent=A new confirmation e-mail has been sent to <b>%s</b>, please check your inbox within the next %d hours to complete the confirmation process. add_email_confirmation_sent=A new confirmation e-mail has been sent to <b>%s</b>, please check your inbox within the next %d hours to complete the confirmation process.
@ -418,9 +422,9 @@ issues.filter_type.all_issues=All issues
issues.filter_type.assigned_to_you=Assigned to you issues.filter_type.assigned_to_you=Assigned to you
issues.filter_type.created_by_you=Created by you issues.filter_type.created_by_you=Created by you
issues.filter_type.mentioning_you=Mentioning you issues.filter_type.mentioning_you=Mentioning you
issues.filter_sort=Sort issues.filter_sort=Kārtot
issues.filter_sort.latest=Newest issues.filter_sort.latest=Jaunākie
issues.filter_sort.oldest=Oldest issues.filter_sort.oldest=Vecakie
issues.filter_sort.recentupdate=Recently updated issues.filter_sort.recentupdate=Recently updated
issues.filter_sort.leastupdate=Least recently updated issues.filter_sort.leastupdate=Least recently updated
issues.filter_sort.mostcomment=Most commented issues.filter_sort.mostcomment=Most commented
@ -429,12 +433,12 @@ issues.opened_by=opened %[1]s by <a href="%[2]s">%[3]s</a>
issues.opened_by_fake=opened %[1]s by %[2]s issues.opened_by_fake=opened %[1]s by %[2]s
issues.previous=Previous issues.previous=Previous
issues.next=Next issues.next=Next
issues.open_title=Open issues.open_title=Atvērta
issues.closed_title=Closed issues.closed_title=Slēgta
issues.num_comments=%d comments issues.num_comments=%d komentāri
issues.commented_at=`commented <a id="%[1]s" href="#%[1]s">%[2]s</a>` issues.commented_at=`commented <a id="%[1]s" href="#%[1]s">%[2]s</a>`
issues.no_content=There is no content yet. issues.no_content=There is no content yet.
issues.close_issue=Close issues.close_issue=Aizvērt
issues.close_comment_issue=Close and comment issues.close_comment_issue=Close and comment
issues.reopen_issue=Reopen issues.reopen_issue=Reopen
issues.reopen_comment_issue=Reopen and comment issues.reopen_comment_issue=Reopen and comment
@ -447,9 +451,9 @@ issues.admin=Admin
issues.owner=Owner issues.owner=Owner
issues.sign_up_for_free=Sign up for free issues.sign_up_for_free=Sign up for free
issues.sign_in_require_desc=to join this conversation. Already have an account? <a href="%s">Sign in to comment</a> issues.sign_in_require_desc=to join this conversation. Already have an account? <a href="%s">Sign in to comment</a>
issues.edit=Edit issues.edit=Labot
issues.cancel=Cancel issues.cancel=Atcelt
issues.save=Save issues.save=Saglabāt
issues.label_title=Label name issues.label_title=Label name
issues.label_color=Label color issues.label_color=Label color
issues.label_count=%d labels issues.label_count=%d labels
@ -490,18 +494,18 @@ milestones.close_tab=%d Closed
milestones.closed=Closed %s milestones.closed=Closed %s
milestones.no_due_date=No due date milestones.no_due_date=No due date
milestones.open=Open milestones.open=Open
milestones.close=Close milestones.close=Aizvērt
milestones.new_subheader=Create milestones to organize your issues. milestones.new_subheader=Create milestones to organize your issues.
milestones.create=Create Milestone milestones.create=Create Milestone
milestones.title=Title milestones.title=Virsraksts
milestones.desc=Description milestones.desc=Apraksts
milestones.due_date=Due Date (optional) milestones.due_date=Due Date (optional)
milestones.clear=Clear milestones.clear=Clear
milestones.invalid_due_date_format=Due date format is invalid, must be 'year-mm-dd'. milestones.invalid_due_date_format=Due date format is invalid, must be 'year-mm-dd'.
milestones.create_success=Milestone '%s' has been created successfully! milestones.create_success=Milestone '%s' has been created successfully!
milestones.edit=Edit Milestone milestones.edit=Edit Milestone
milestones.edit_subheader=Use better description for milestones so people won't be confused. milestones.edit_subheader=Use better description for milestones so people won't be confused.
milestones.cancel=Cancel milestones.cancel=Atcelt
milestones.modify=Modify Milestone milestones.modify=Modify Milestone
milestones.edit_success=Changes of milestone '%s' has been saved successfully! milestones.edit_success=Changes of milestone '%s' has been saved successfully!
milestones.deletion=Milestone Deletion milestones.deletion=Milestone Deletion
@ -585,8 +589,8 @@ settings.slack_channel=Kanāls
settings.deploy_keys=Izvietot atslēgas settings.deploy_keys=Izvietot atslēgas
settings.add_deploy_key=Add Deploy Key settings.add_deploy_key=Add Deploy Key
settings.no_deploy_keys=You haven't added any deploy key. settings.no_deploy_keys=You haven't added any deploy key.
settings.title=Title settings.title=Virsraksts
settings.deploy_key_content=Content settings.deploy_key_content=Saturs
settings.key_been_used=Deploy key content has been used. settings.key_been_used=Deploy key content has been used.
settings.key_name_used=Deploy key with same name has already existed. settings.key_name_used=Deploy key with same name has already existed.
settings.add_key_success=New deploy key '%s' has been added successfully! settings.add_key_success=New deploy key '%s' has been added successfully!
@ -630,7 +634,6 @@ release.tag_name_already_exist=Laidiens ar šādu taga nosaukumu jau eksistē.
[org] [org]
org_name_holder=Organizācijas nosaukums org_name_holder=Organizācijas nosaukums
org_name_helper=Labi organizāciju nosaukumi ir īsi un tādi, kurus viegli atcerēties. org_name_helper=Labi organizāciju nosaukumi ir īsi un tādi, kurus viegli atcerēties.
org_email_helper=Uz organizācijas e-pastu tiks sūtītas visas notifikācias un apstiprinājumi.
create_org=Izveidot organizāciju create_org=Izveidot organizāciju
repo_updated=Atjaunināts repo_updated=Atjaunināts
people=Personas people=Personas
@ -655,9 +658,9 @@ settings.full_name=Pilns vārds, uzvārds
settings.website=Mājas lapa settings.website=Mājas lapa
settings.location=Atrašanās vieta settings.location=Atrašanās vieta
settings.update_settings=Mainīt iestatījumus settings.update_settings=Mainīt iestatījumus
settings.change_orgname=Mainīts organizācijas nosaukums
settings.change_orgname_desc=Organizācijas nosaukums tiks mainīts, vai vēlaties turpinat? Tas ietekmēs saites, kas attiecas uz šo organizāciju.
settings.update_setting_success=Organizācijas iestatījumi tika veiksmīgi saglabāti. settings.update_setting_success=Organizācijas iestatījumi tika veiksmīgi saglabāti.
settings.change_orgname_prompt=This change will affect how links relate to the organization.
settings.update_avatar_success=Organization avatar setting has been updated successfully.
settings.delete=Dzēst organizāciju settings.delete=Dzēst organizāciju
settings.delete_account=Dzēst šo organizāciju settings.delete_account=Dzēst šo organizāciju
settings.delete_prompt=Šī darbība pilnībā dzēsīs šo organizāciju, kā arī tā ir <strong>NEATGRIEZENISKA</strong>! settings.delete_prompt=Šī darbība pilnībā dzēsīs šo organizāciju, kā arī tā ir <strong>NEATGRIEZENISKA</strong>!
@ -774,9 +777,9 @@ users.admin=Administrators
users.repos=Repozitoriji users.repos=Repozitoriji
users.created=Izveidots users.created=Izveidots
users.edit=Labot users.edit=Labot
users.auth_source=Autorizācijas avots users.auth_source=Authentication Source
users.local=Iebūvētā users.local=Iebūvētā
users.auth_login_name=Autorizāciju, pietiekšanās vārds users.auth_login_name=Authentication Login Name
users.update_profile_success=Konta profils tika veiksmīgi saglabāts. users.update_profile_success=Konta profils tika veiksmīgi saglabāts.
users.edit_account=Labot kontu users.edit_account=Labot kontu
users.is_activated=Konts ir aktivizēts users.is_activated=Konts ir aktivizēts
@ -800,14 +803,14 @@ repos.watches=Vērošana
repos.stars=Atzīmētās zvaigznītes repos.stars=Atzīmētās zvaigznītes
repos.issues=Problēmas repos.issues=Problēmas
auths.auth_manage_panel=Autorizāciju pārvaldības panelis auths.auth_manage_panel=Authentication Manage Panel
auths.new=Pievienot jaunu autorizācijas veidu auths.new=Add New Authentication Source
auths.name=Nosaukums auths.name=Nosaukums
auths.type=Veids auths.type=Veids
auths.enabled=Iespējota auths.enabled=Iespējota
auths.updated=Atjaunināta auths.updated=Atjaunināta
auths.auth_type=Autorizācijas veids auths.auth_type=Authentication Type
auths.auth_name=Autorizācijas nosaukums auths.auth_name=Authentication Name
auths.domain=Domēns auths.domain=Domēns
auths.host=Resursdators auths.host=Resursdators
auths.port=Ports auths.port=Ports
@ -820,7 +823,7 @@ auths.attribute_mail=E-mail attribute
auths.filter=User Filter auths.filter=User Filter
auths.admin_filter=Admin Filter auths.admin_filter=Admin Filter
auths.ms_ad_sa=MS Ad SA auths.ms_ad_sa=MS Ad SA
auths.smtp_auth=SMTP autorizācijas veids auths.smtp_auth=SMTP Authentication Type
auths.smtphost=SMTP resursdators auths.smtphost=SMTP resursdators
auths.smtpport=SMTP ports auths.smtpport=SMTP ports
auths.enable_tls=Iespējot TLS šifrēšanu auths.enable_tls=Iespējot TLS šifrēšanu
@ -828,13 +831,13 @@ auths.skip_tls_verify=Skip TLS Verify
auths.pam_service_name=PAM Service Name auths.pam_service_name=PAM Service Name
auths.enable_auto_register=Iespējot automātisko reģistrāciju auths.enable_auto_register=Iespējot automātisko reģistrāciju
auths.tips=Padomi auths.tips=Padomi
auths.edit=Labot autorizācijas iestatījumus auths.edit=Edit Authentication Setting
auths.activated=Autentifikācija ir aktivizēta auths.activated=Autentifikācija ir aktivizēta
auths.update_success=Autorizācijas iestatījumi tika veiksmīgi saglabāti. auths.update_success=Authentication setting has been updated successfully.
auths.update=Mainīt autorizācijas iestatījumus auths.update=Update Authentication Setting
auths.delete=Dzēst šo autorizāciju auths.delete=Delete This Authentication
auths.delete_auth_title=Autorizācijas dzēšana auths.delete_auth_title=Authentication Deletion
auths.delete_auth_desc=Šī autorizācija tiks dzēsta, vai vēlaties turpināt? auths.delete_auth_desc=This authentication is going to be deleted, do you want to continue?
config.server_config=Servera konfigurācija config.server_config=Servera konfigurācija
config.app_name=Lietotnes nosaukums config.app_name=Lietotnes nosaukums
@ -953,6 +956,6 @@ raw_minutes=minūtes
[dropzone] [dropzone]
default_message=Drop files here or click to upload. default_message=Drop files here or click to upload.
invalid_input_type=You can't upload files of this type. invalid_input_type=You can't upload files of this type.
file_too_big=File size({{filesize}} MB) exceeds maximum size({{maxFilesize}} MB). file_too_big=Faila izmērs ({{filesize}} MB) pārsniedz maksimālo atļauto izmēru ({{maxFilesize}} MB).
remove_file=Remove file remove_file=Noņemt failu

41
conf/locale/locale_zh-CN.ini

@ -241,7 +241,7 @@ location=所在地区
update_profile=更新信息 update_profile=更新信息
update_profile_success=您的个人信息更新成功! update_profile_success=您的个人信息更新成功!
change_username=用户名将被修改 change_username=用户名将被修改
change_username_desc=用户名被修改,您确定要继续操作吗?这将会影响到所有与您帐户有关的链接。 change_username_prompt=该操作将会影响到所有与您帐户有关的链接
continue=继续操作 continue=继续操作
cancel=取消操作 cancel=取消操作
@ -256,6 +256,7 @@ update_avatar_success=您的头像设置更新成功!
change_password=修改密码 change_password=修改密码
old_password=当前密码 old_password=当前密码
new_password=新的密码 new_password=新的密码
retype_new_password=重新输入新的密码
password_incorrect=当前密码不正确! password_incorrect=当前密码不正确!
change_password_success=密码修改成功!您现在可以使用新的密码登录。 change_password_success=密码修改成功!您现在可以使用新的密码登录。
@ -265,6 +266,9 @@ email_desc=您的主要邮箱地址将被用于通知提醒和其它操作。
primary=主要 primary=主要
primary_email=设为主要 primary_email=设为主要
delete_email=删除 delete_email=删除
email_deletion=邮箱删除操作
email_deletion_desc=删除该邮箱地址将会移除所有相关的信息。是否继续?
email_deletion_success=邮箱删除成功!
add_new_email=添加新的邮箱地址 add_new_email=添加新的邮箱地址
add_email=添加邮箱 add_email=添加邮箱
add_email_confirmation_sent=一封待确认的电子邮件已发送到 <b>%s</b>,请在 %d 小时内检查您的收件箱,并完成确认过程。 add_email_confirmation_sent=一封待确认的电子邮件已发送到 <b>%s</b>,请在 %d 小时内检查您的收件箱,并完成确认过程。
@ -281,7 +285,7 @@ key_name=密钥名称
key_content=密钥内容 key_content=密钥内容
add_key_success=新的 SSH 密钥 '%s' 添加成功! add_key_success=新的 SSH 密钥 '%s' 添加成功!
delete_key=删除 delete_key=删除
ssh_key_deletion=删除 SSH 公钥 ssh_key_deletion=删除 SSH 公钥操作
ssh_key_deletion_desc=删除该 SSH 公钥将删除所有与您帐户相关的访问权限。是否继续? ssh_key_deletion_desc=删除该 SSH 公钥将删除所有与您帐户相关的访问权限。是否继续?
ssh_key_deletion_success=SSH 公钥删除成功! ssh_key_deletion_success=SSH 公钥删除成功!
add_on=增加于 add_on=增加于
@ -303,7 +307,7 @@ token_name=令牌名称
generate_token=生成令牌 generate_token=生成令牌
generate_token_succees=新的操作令牌生成成功!您必须立即复制到一个安全的地方,因为该令牌只会显示一次! generate_token_succees=新的操作令牌生成成功!您必须立即复制到一个安全的地方,因为该令牌只会显示一次!
delete_token=删除令牌 delete_token=删除令牌
access_token_deletion=删除个人操作令牌 access_token_deletion=删除个人操作令牌操作
access_token_deletion_desc=删除该个人操作令牌将删除所有相关的应用程序的访问权限。是否继续? access_token_deletion_desc=删除该个人操作令牌将删除所有相关的应用程序的访问权限。是否继续?
delete_token_success=个人操作令牌删除成功!请更新与该令牌有关的所有应用。 delete_token_success=个人操作令牌删除成功!请更新与该令牌有关的所有应用。
@ -457,7 +461,7 @@ issues.label_open_issues=%d 个开启的工单
issues.label_edit=编辑 issues.label_edit=编辑
issues.label_delete=删除 issues.label_delete=删除
issues.label_modify=修改标签 issues.label_modify=修改标签
issues.label_deletion=删除标签 issues.label_deletion=删除标签操作
issues.label_deletion_desc=删除该标签将会移除所有工单中相关的信息。是否继续? issues.label_deletion_desc=删除该标签将会移除所有工单中相关的信息。是否继续?
issues.label_deletion_success=标签删除成功! issues.label_deletion_success=标签删除成功!
@ -504,7 +508,7 @@ milestones.edit_subheader=使用更加清晰的描述来帮助人们更好地理
milestones.cancel=取消 milestones.cancel=取消
milestones.modify=修改里程碑 milestones.modify=修改里程碑
milestones.edit_success=里程碑 '%s' 的修改内容已经生效! milestones.edit_success=里程碑 '%s' 的修改内容已经生效!
milestones.deletion=删除里程碑 milestones.deletion=删除里程碑操作
milestones.deletion_desc=删除该里程碑将会移除所有工单中相关的信息。是否继续? milestones.deletion_desc=删除该里程碑将会移除所有工单中相关的信息。是否继续?
milestones.deletion_success=里程碑删除成功! milestones.deletion_success=里程碑删除成功!
@ -630,7 +634,6 @@ release.tag_name_already_exist=已经存在使用相同标签进行发布的版
[org] [org]
org_name_holder=组织名称 org_name_holder=组织名称
org_name_helper=伟大的组织都有一个简短而寓意深刻的名字。 org_name_helper=伟大的组织都有一个简短而寓意深刻的名字。
org_email_helper=组织的邮箱用于接收所有通知和确认邮件。
create_org=创建组织 create_org=创建组织
repo_updated=最后更新于 repo_updated=最后更新于
people=组织成员 people=组织成员
@ -655,9 +658,9 @@ settings.full_name=组织全名
settings.website=官方网站 settings.website=官方网站
settings.location=所在地区 settings.location=所在地区
settings.update_settings=更新组织设置 settings.update_settings=更新组织设置
settings.change_orgname=组织名称将被修改
settings.change_orgname_desc=组织名称被修改,您确定要继续操作吗?这将会影响到所有与该组织有关的链接。
settings.update_setting_success=组织设置更新成功! settings.update_setting_success=组织设置更新成功!
settings.change_orgname_prompt=该操作将会影响到所有与该组织有关的链接
settings.update_avatar_success=组织头像更新成功!
settings.delete=删除组织 settings.delete=删除组织
settings.delete_account=删除当前组织 settings.delete_account=删除当前组织
settings.delete_prompt=删除操作会永久清除该组织的信息,并且 <strong>不可恢复</strong>! settings.delete_prompt=删除操作会永久清除该组织的信息,并且 <strong>不可恢复</strong>!
@ -776,7 +779,7 @@ users.created=创建时间
users.edit=编辑 users.edit=编辑
users.auth_source=认证源 users.auth_source=认证源
users.local=本地 users.local=本地
users.auth_login_name=认证登录名 users.auth_login_name=认证登录名
users.update_profile_success=该用户信息更新成功! users.update_profile_success=该用户信息更新成功!
users.edit_account=编辑用户信息 users.edit_account=编辑用户信息
users.is_activated=该用户已被激活 users.is_activated=该用户已被激活
@ -800,14 +803,14 @@ repos.watches=关注数
repos.stars=点赞数 repos.stars=点赞数
repos.issues=工单数 repos.issues=工单数
auths.auth_manage_panel=授权认证管理面板 auths.auth_manage_panel=认证管理面板
auths.new=添加新的认证源 auths.new=添加新的认证源
auths.name=认证名称 auths.name=认证名称
auths.type=认证类型 auths.type=认证类型
auths.enabled=已启用 auths.enabled=已启用
auths.updated=最后更新时间 auths.updated=最后更新时间
auths.auth_type=授权类型 auths.auth_type=认证类型
auths.auth_name=授权名称 auths.auth_name=认证名称
auths.domain=域名 auths.domain=域名
auths.host=主机地址 auths.host=主机地址
auths.port=主机端口 auths.port=主机端口
@ -820,7 +823,7 @@ auths.attribute_mail=邮箱属性
auths.filter=用户过滤规则 auths.filter=用户过滤规则
auths.admin_filter=管理员过滤规则 auths.admin_filter=管理员过滤规则
auths.ms_ad_sa=Ms Ad SA auths.ms_ad_sa=Ms Ad SA
auths.smtp_auth=SMTP 授权类型 auths.smtp_auth=SMTP 认证类型
auths.smtphost=SMTP 主机地址 auths.smtphost=SMTP 主机地址
auths.smtpport=SMTP 主机端口 auths.smtpport=SMTP 主机端口
auths.enable_tls=启用 TLS 加密 auths.enable_tls=启用 TLS 加密
@ -828,13 +831,13 @@ auths.skip_tls_verify=忽略 TLS 验证
auths.pam_service_name=PAM 服务名称 auths.pam_service_name=PAM 服务名称
auths.enable_auto_register=允许授权用户自动注册 auths.enable_auto_register=允许授权用户自动注册
auths.tips=帮助提示 auths.tips=帮助提示
auths.edit=修改授权认证设置 auths.edit=编辑认证设置
auths.activated=该授权认证已经启用 auths.activated=该授权认证已经启用
auths.update_success=授权认证设置更新成功! auths.update_success=认证设置更新成功!
auths.update=更新授权认证信息 auths.update=更新认证设置
auths.delete=删除该授权认证 auths.delete=删除该认证
auths.delete_auth_title=授权认证删除操作 auths.delete_auth_title=删除认证操作
auths.delete_auth_desc=授权认证将被删除,您确定要继续吗 auths.delete_auth_desc=认证将被删除。是否继续
config.server_config=服务器配置 config.server_config=服务器配置
config.app_name=应用名称 config.app_name=应用名称

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.6.9.0910 Beta" const APP_VER = "0.6.10.0910 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

2
models/issue.go

@ -546,7 +546,7 @@ func GetIssueCountByPoster(uid, rid int64, isClosed bool) int64 {
// IssueUser represents an issue-user relation. // IssueUser represents an issue-user relation.
type IssueUser struct { type IssueUser struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"uid INDEX"` // User ID. UID int64 `xorm:"INDEX"` // User ID.
IssueID int64 IssueID int64
RepoID int64 `xorm:"INDEX"` RepoID int64 `xorm:"INDEX"`
MilestoneID int64 MilestoneID int64

2
models/models.go

@ -87,7 +87,7 @@ func init() {
new(Team), new(OrgUser), new(TeamUser), new(TeamRepo), new(Team), new(OrgUser), new(TeamUser), new(TeamRepo),
new(Notice), new(EmailAddress)) new(Notice), new(EmailAddress))
gonicNames := []string{"SSL"} gonicNames := []string{"UID", "SSL"}
for _, name := range gonicNames { for _, name := range gonicNames {
core.LintGonicMapper[name] = true core.LintGonicMapper[name] = true
} }

2
models/repo.go

@ -1658,7 +1658,7 @@ func NotifyWatchers(act *Action) error {
type Star struct { type Star struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"uid UNIQUE(s)"` UID int64 `xorm:"UNIQUE(s)"`
RepoID int64 `xorm:"UNIQUE(s)"` RepoID int64 `xorm:"UNIQUE(s)"`
} }

2
models/token.go

@ -14,7 +14,7 @@ import (
// AccessToken represents a personal access token. // AccessToken represents a personal access token.
type AccessToken struct { type AccessToken struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"uid INDEX"` UID int64 `xorm:"INDEX"`
Name string Name string
Sha1 string `xorm:"UNIQUE VARCHAR(40)"` Sha1 string `xorm:"UNIQUE VARCHAR(40)"`
Created time.Time `xorm:"CREATED"` Created time.Time `xorm:"CREATED"`

20
models/user.go

@ -110,8 +110,8 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) {
// EmailAdresses is the list of all email addresses of a user. Can contain the // EmailAdresses is the list of all email addresses of a user. Can contain the
// primary email address, but is not obligatory // primary email address, but is not obligatory
type EmailAddress struct { type EmailAddress struct {
Id int64 ID int64 `xorm:"pk autoincr"`
Uid int64 `xorm:"INDEX NOT NULL"` UID int64 `xorm:"INDEX NOT NULL"`
Email string `xorm:"UNIQUE NOT NULL"` Email string `xorm:"UNIQUE NOT NULL"`
IsActivated bool IsActivated bool
IsPrimary bool `xorm:"-"` IsPrimary bool `xorm:"-"`
@ -624,7 +624,7 @@ func deleteUser(e *xorm.Session, u *User) error {
&Follow{FollowID: u.Id}, &Follow{FollowID: u.Id},
&Action{UserID: u.Id}, &Action{UserID: u.Id},
&IssueUser{UID: u.Id}, &IssueUser{UID: u.Id},
&EmailAddress{Uid: u.Id}, &EmailAddress{UID: u.Id},
); err != nil { ); err != nil {
return fmt.Errorf("deleteUser: %v", err) return fmt.Errorf("deleteUser: %v", err)
} }
@ -831,11 +831,11 @@ func AddEmailAddress(email *EmailAddress) error {
func (email *EmailAddress) Activate() error { func (email *EmailAddress) Activate() error {
email.IsActivated = true email.IsActivated = true
if _, err := x.Id(email.Id).AllCols().Update(email); err != nil { if _, err := x.Id(email.ID).AllCols().Update(email); err != nil {
return err return err
} }
if user, err := GetUserByID(email.Uid); err != nil { if user, err := GetUserByID(email.UID); err != nil {
return err return err
} else { } else {
user.Rands = GetUserSalt() user.Rands = GetUserSalt()
@ -851,7 +851,7 @@ func DeleteEmailAddress(email *EmailAddress) error {
return ErrEmailNotExist return ErrEmailNotExist
} }
if _, err = x.Id(email.Id).Delete(email); err != nil { if _, err = x.Id(email.ID).Delete(email); err != nil {
return err return err
} }
@ -871,12 +871,12 @@ func MakeEmailPrimary(email *EmailAddress) error {
return ErrEmailNotActivated return ErrEmailNotActivated
} }
user := &User{Id: email.Uid} user := &User{Id: email.UID}
has, err = x.Get(user) has, err = x.Get(user)
if err != nil { if err != nil {
return err return err
} else if !has { } else if !has {
return ErrUserNotExist{email.Uid, ""} return ErrUserNotExist{email.UID, ""}
} }
// Make sure the former primary email doesn't disappear // Make sure the former primary email doesn't disappear
@ -885,7 +885,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
if err != nil { if err != nil {
return err return err
} else if !has { } else if !has {
former_primary_email.Uid = user.Id former_primary_email.UID = user.Id
former_primary_email.IsActivated = user.IsActive former_primary_email.IsActivated = user.IsActive
x.Insert(former_primary_email) x.Insert(former_primary_email)
} }
@ -962,7 +962,7 @@ func GetUserByEmail(email string) (*User, error) {
return nil, err return nil, err
} }
if has { if has {
return GetUserByID(emailAddress.Uid) return GetUserByID(emailAddress.UID)
} }
return nil, ErrUserNotExist{0, "email"} return nil, ErrUserNotExist{0, "email"}

2
modules/auth/user_form.go

@ -110,7 +110,7 @@ func (f *UploadAvatarForm) Validate(ctx *macaron.Context, errs binding.Errors) b
} }
type AddEmailForm struct { type AddEmailForm struct {
Email string `binding:"Required;Email;MaxSize(50)"` Email string `binding:"Required;Email;MaxSize(254)"`
} }
func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

16
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

3
public/less/_base.less

@ -253,9 +253,6 @@ footer {
text-align: center; text-align: center;
color: #428bca; color: #428bca;
} }
.ui.language.dropdown {
z-index: 10000;
}
.links >* { .links >* {
border-left: 1px solid #d6d6d6; border-left: 1px solid #d6d6d6;
padding-left: 8px; padding-left: 8px;

11
public/less/_user.less

@ -3,10 +3,19 @@
padding-bottom: @footer-margin * 2; padding-bottom: @footer-margin * 2;
&.settings { &.settings {
.key.list { .list {
.item.ui.grid { .item.ui.grid {
margin-top: 15px; margin-top: 15px;
} }
} }
.email.list {
.item:not(:first-child) {
border-top: 1px solid #eaeaea;
height: 50px;
.button {
margin-top: -10px;
}
}
}
} }
} }

127
routers/user/setting.go

@ -132,21 +132,41 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) {
ctx.Redirect(setting.AppSubUrl + "/user/settings") ctx.Redirect(setting.AppSubUrl + "/user/settings")
} }
func SettingsEmails(ctx *middleware.Context) { func SettingsPassword(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsEmails"] = true ctx.Data["PageIsSettingsPassword"] = true
ctx.HTML(200, SETTINGS_PASSWORD)
}
emails, err := models.GetEmailAddresses(ctx.User.Id) func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm) {
if err != nil { ctx.Data["Title"] = ctx.Tr("settings")
ctx.Handle(500, "GetEmailAddresses", err) ctx.Data["PageIsSettingsPassword"] = true
if ctx.HasError() {
ctx.HTML(200, SETTINGS_PASSWORD)
return return
} }
ctx.Data["Emails"] = emails
ctx.HTML(200, SETTINGS_EMAILS) if !ctx.User.ValidatePassword(form.OldPassword) {
ctx.Flash.Error(ctx.Tr("settings.password_incorrect"))
} else if form.Password != form.Retype {
ctx.Flash.Error(ctx.Tr("form.password_not_match"))
} else {
ctx.User.Passwd = form.Password
ctx.User.Salt = models.GetUserSalt()
ctx.User.EncodePasswd()
if err := models.UpdateUser(ctx.User); err != nil {
ctx.Handle(500, "UpdateUser", err)
return
}
log.Trace("User password updated: %s", ctx.User.Name)
ctx.Flash.Success(ctx.Tr("settings.change_password_success"))
}
ctx.Redirect(setting.AppSubUrl + "/user/settings/password")
} }
func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) { func SettingsEmails(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsEmails"] = true ctx.Data["PageIsSettingsEmails"] = true
@ -157,51 +177,43 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
} }
ctx.Data["Emails"] = emails ctx.Data["Emails"] = emails
// Delete E-mail address. ctx.HTML(200, SETTINGS_EMAILS)
if ctx.Query("_method") == "DELETE" { }
id := ctx.QueryInt64("id")
if id <= 0 {
return
}
if err = models.DeleteEmailAddress(&models.EmailAddress{Id: id}); err != nil { func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
ctx.Handle(500, "DeleteEmail", err) ctx.Data["Title"] = ctx.Tr("settings")
} else { ctx.Data["PageIsSettingsEmails"] = true
log.Trace("Email address deleted: %s", ctx.User.Name)
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
}
return
}
// Make emailaddress primary. // Make emailaddress primary.
if ctx.Query("_method") == "PRIMARY" { if ctx.Query("_method") == "PRIMARY" {
id := ctx.QueryInt64("id") if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil {
if id <= 0 { ctx.Handle(500, "MakeEmailPrimary", err)
return return
} }
if err = models.MakeEmailPrimary(&models.EmailAddress{Id: id}); err != nil {
ctx.Handle(500, "MakeEmailPrimary", err)
} else {
log.Trace("Email made primary: %s", ctx.User.Name) log.Trace("Email made primary: %s", ctx.User.Name)
ctx.Redirect(setting.AppSubUrl + "/user/settings/email") ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
}
return return
} }
// Add Email address. // Add Email address.
emails, err := models.GetEmailAddresses(ctx.User.Id)
if err != nil {
ctx.Handle(500, "GetEmailAddresses", err)
return
}
ctx.Data["Emails"] = emails
if ctx.HasError() { if ctx.HasError() {
ctx.HTML(200, SETTINGS_EMAILS) ctx.HTML(200, SETTINGS_EMAILS)
return return
} }
cleanEmail := strings.Replace(form.Email, "\n", "", -1)
e := &models.EmailAddress{ e := &models.EmailAddress{
Uid: ctx.User.Id, UID: ctx.User.Id,
Email: cleanEmail, Email: strings.TrimSpace(form.Email),
IsActivated: !setting.Service.RegisterEmailConfirm, IsActivated: !setting.Service.RegisterEmailConfirm,
} }
if err := models.AddEmailAddress(e); err != nil { if err := models.AddEmailAddress(e); err != nil {
if models.IsErrEmailAlreadyUsed(err) { if models.IsErrEmailAlreadyUsed(err) {
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), SETTINGS_EMAILS, &form) ctx.RenderWithErr(ctx.Tr("form.email_been_used"), SETTINGS_EMAILS, &form)
@ -209,7 +221,8 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
} }
ctx.Handle(500, "AddEmailAddress", err) ctx.Handle(500, "AddEmailAddress", err)
return return
} else { }
// Send confirmation e-mail // Send confirmation e-mail
if setting.Service.RegisterEmailConfirm { if setting.Service.RegisterEmailConfirm {
mailer.SendActivateEmail(ctx.Render, ctx.User, e) mailer.SendActivateEmail(ctx.Render, ctx.User, e)
@ -217,56 +230,26 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil { if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
log.Error(4, "Set cache(MailResendLimit) fail: %v", err) log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
} }
ctx.Flash.Info(ctx.Tr("settings.add_email_confirmation_sent", cleanEmail, setting.Service.ActiveCodeLives/60)) ctx.Flash.Info(ctx.Tr("settings.add_email_confirmation_sent", e.Email, setting.Service.ActiveCodeLives/60))
} else { } else {
ctx.Flash.Success(ctx.Tr("settings.add_email_success")) ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
} }
log.Trace("Email address added: %s", e.Email) log.Trace("Email address added: %s", e.Email)
ctx.Redirect(setting.AppSubUrl + "/user/settings/email") ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
return
}
ctx.HTML(200, SETTINGS_EMAILS)
} }
func SettingsPassword(ctx *middleware.Context) { func DeleteEmail(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("settings") if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil {
ctx.Data["PageIsSettingsPassword"] = true ctx.Handle(500, "DeleteEmail", err)
ctx.HTML(200, SETTINGS_PASSWORD)
}
func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsPassword"] = true
if ctx.HasError() {
ctx.HTML(200, SETTINGS_PASSWORD)
return
}
tmpUser := &models.User{
Passwd: form.OldPassword,
Salt: ctx.User.Salt,
}
tmpUser.EncodePasswd()
if ctx.User.Passwd != tmpUser.Passwd {
ctx.Flash.Error(ctx.Tr("settings.password_incorrect"))
} else if form.Password != form.Retype {
ctx.Flash.Error(ctx.Tr("form.password_not_match"))
} else {
ctx.User.Passwd = form.Password
ctx.User.Salt = models.GetUserSalt()
ctx.User.EncodePasswd()
if err := models.UpdateUser(ctx.User); err != nil {
ctx.Handle(500, "UpdateUser", err)
return return
} }
log.Trace("User password updated: %s", ctx.User.Name) log.Trace("Email address deleted: %s", ctx.User.Name)
ctx.Flash.Success(ctx.Tr("settings.change_password_success"))
}
ctx.Redirect(setting.AppSubUrl + "/user/settings/password") ctx.Flash.Success(ctx.Tr("settings.email_deletion_success"))
ctx.JSON(200, map[string]interface{}{
"redirect": setting.AppSubUrl + "/user/settings/email",
})
} }
func SettingsSSHKeys(ctx *middleware.Context) { func SettingsSSHKeys(ctx *middleware.Context) {

2
templates/.VERSION

@ -1 +1 @@
0.6.9.0910 Beta 0.6.10.0910 Beta

94
templates/user/settings/email.tmpl

@ -1,60 +1,70 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="user settings emails">
<div id="setting-wrapper" class="main-wrapper"> <div class="ui container">
<div id="user-profile-setting" class="container clear"> <div class="ui grid">
{{template "user/settings/nav" .}} {{template "user/settings/navbar" .}}
<div class="grid-4-5 left"> <div class="twelve wide column content">
<div class="setting-content"> {{template "base/alert" .}}
{{template "ng/base/alert" .}} <h4 class="ui top attached header">
<div id="user-email-setting-content"> {{.i18n.Tr "settings.manage_emails"}}
<div id="user-email-panel" class="panel panel-radius"> </h4>
<div class="panel-header"> <div class="ui attached segment">
<strong>{{.i18n.Tr "settings.manage_emails"}}</strong> <div class="ui email list">
</div> <div class="item">
<ul class="panel-body setting-list"> {{.i18n.Tr "settings.email_desc"}}
<li>{{.i18n.Tr "settings.email_desc"}}</li>
{{range .Emails}}
<li class="email clear">
<div class="email-content left">
<p><strong>{{.Email}}</strong> {{if .IsPrimary}} <span class="text-red">{{$.i18n.Tr "settings.primary"}}</span> {{end}}</p>
</div> </div>
{{range .Emails}}
<div class="item ui grid">
<div class="column">
<strong>{{.Email}}</strong>
{{if .IsPrimary}}<span class="text red">{{$.i18n.Tr "settings.primary"}}</span>{{end}}
{{if not .IsPrimary}} {{if not .IsPrimary}}
<div class="ui right">
<button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
{{$.i18n.Tr "settings.delete_key"}}
</button>
</div>
{{if .IsActivated}} {{if .IsActivated}}
<form action="{{AppSubUrl}}/user/settings/email" method="post"> <div class="ui right">
<form action="{{$.Link}}" method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<input name="_method" type="hidden" value="PRIMARY"> <input name="_method" type="hidden" value="PRIMARY">
<input name="id" type="hidden" value="{{.Id}}"> <input name="id" type="hidden" value="{{.ID}}">
<button class="right email-btn btn btn-small btn-green btn-radius">{{$.i18n.Tr "settings.primary_email"}}</button> <button class="ui green tiny button">{{$.i18n.Tr "settings.primary_email"}}</button>
</form> </form>
</div>
{{end}} {{end}}
<form action="{{AppSubUrl}}/user/settings/email" method="post">
{{$.CsrfTokenHtml}}
<input name="_method" type="hidden" value="DELETE">
<input name="id" type="hidden" value="{{.Id}}">
<button class="right email-btn btn btn-small btn-red btn-radius" style="margin-right: 5px">{{$.i18n.Tr "settings.delete_email"}}</button>
</form>
{{end}} {{end}}
</li> </div>
</div>
{{end}} {{end}}
</ul>
<div class="panel-header">
<strong>{{.i18n.Tr "settings.add_new_email"}}</strong>
</div> </div>
<form class="form form-align panel-body" id="add-email-form" action="{{AppSubUrl}}/user/settings/email" method="post"> </div>
<div class="ui attached bottom segment">
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<p class="field"> <div class="required field {{if .Err_Email}}error{{end}}">
<label class="req" for="email">{{.i18n.Tr "email"}}</label> <label for="email">{{.i18n.Tr "settings.add_new_email"}}</label>
<input class="ipt ipt-large ipt-radius" id="email" name="email" type="text" required /> <input id="email" name="email" type="email" autofocus required>
</p> </div>
<p class="field"> <button class="ui green button">
<label></label> {{.i18n.Tr "settings.add_email"}}
<button class="btn btn-green btn-large btn-radius" id="email-add-btn">{{.i18n.Tr "settings.add_email"}}</button> </button>
</p>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="ui small basic delete modal">
<div class="ui icon header">
<i class="trash icon"></i>
{{.i18n.Tr "settings.email_deletion"}}
</div>
<div class="content">
<p>{{.i18n.Tr "settings.email_deletion_desc"}}</p>
</div> </div>
{{template "base/delete_modal_actions" .}}
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}

59
templates/user/settings/password.tmpl

@ -1,37 +1,36 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="user settings password">
<div id="setting-wrapper" class="main-wrapper"> <div class="ui container">
<div id="user-profile-setting" class="container clear"> <div class="ui grid">
{{template "user/settings/nav" .}} {{template "user/settings/navbar" .}}
<div class="grid-4-5 left"> <div class="twelve wide column content">
<div class="setting-content"> {{template "base/alert" .}}
{{template "ng/base/alert" .}} <h4 class="ui top attached header">
<div id="setting-content"> {{.i18n.Tr "settings.change_password"}}
<div id="user-profile-setting-content" class="panel panel-radius"> </h4>
<p class="panel-header"><strong>{{.i18n.Tr "settings.change_password"}}</strong></p> <div class="ui attached segment">
<form class="form form-align panel-body" id="user-profile-form" action="{{AppSubUrl}}/user/settings/password" method="post"> <form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<p class="field"> <div class="required field {{if .Err_OldPassword}}error{{end}}">
<label class="req" for="old-password">{{.i18n.Tr "settings.old_password"}}</label> <label for="old_password">{{.i18n.Tr "settings.old_password"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_OldPassword}}ipt-error{{end}}" id="old-password" name="old_password" type="password" required /> <input id="old_password" name="old_password" type="password" autofocus required>
</p> </div>
<p class="field"> <div class="required field {{if .Err_Password}}error{{end}}">
<label class="req" for="password">{{.i18n.Tr "settings.new_password"}}</label> <label for="password">{{.i18n.Tr "settings.new_password"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" required /> <input id="password" name="password" type="password" required>
</p> </div>
<p class="field"> <div class="required field {{if .Err_Password}}error{{end}}">
<label class="req" for="retype">{{.i18n.Tr "re_type"}}</label> <label for="retype">{{.i18n.Tr "settings.retype_new_password"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Retype}}ipt-error{{end}}" id="retype" name="retype" type="password" required /> <input id="retype" name="retype" type="password" required>
</p>
<p class="field">
<span class="form-label"></span>
<button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "settings.change_password"}}</button>
</p>
</form>
</div> </div>
<div class="field">
<button class="ui green button">{{$.i18n.Tr "settings.change_password"}}</button>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}
Loading…
Cancel
Save