forked from Silverfish/proton-bridge
GODT-1503 GODT-1492: Improve email validation and username in bug report.
This commit is contained in:
@ -39,6 +39,12 @@ var ErrSizeTooLarge = errors.New("file is too big")
|
|||||||
|
|
||||||
// ReportBug reports a new bug from the user.
|
// ReportBug reports a new bug from the user.
|
||||||
func (b *Bridge) ReportBug(osType, osVersion, description, accountName, address, emailClient string, attachLogs bool) error {
|
func (b *Bridge) ReportBug(osType, osVersion, description, accountName, address, emailClient string, attachLogs bool) error {
|
||||||
|
if user, err := b.GetUser(address); err == nil {
|
||||||
|
accountName = user.Username()
|
||||||
|
} else if users := b.GetUsers(); len(users) > 0 {
|
||||||
|
accountName = users[0].Username()
|
||||||
|
}
|
||||||
|
|
||||||
report := pmapi.ReportBugReq{
|
report := pmapi.ReportBugReq{
|
||||||
OS: osType,
|
OS: osType,
|
||||||
OSVersion: osVersion,
|
OSVersion: osVersion,
|
||||||
|
|||||||
@ -181,7 +181,7 @@ SettingsView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isValidEmail(text){
|
function isValidEmail(text){
|
||||||
var reEmail = /\w+@\w+\.\w+/
|
var reEmail = /^[^@]+@[^@]+\.[A-Za-z]+\s*$/
|
||||||
return reEmail.test(text)
|
return reEmail.test(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ func (f *FrontendQt) reportBug(description, address, emailClient string, include
|
|||||||
core.QSysInfo_ProductType(),
|
core.QSysInfo_ProductType(),
|
||||||
core.QSysInfo_PrettyProductName(),
|
core.QSysInfo_PrettyProductName(),
|
||||||
description,
|
description,
|
||||||
"Unknown account",
|
address,
|
||||||
address,
|
address,
|
||||||
emailClient,
|
emailClient,
|
||||||
includeLogs,
|
includeLogs,
|
||||||
|
|||||||
Reference in New Issue
Block a user