~bouncepaw/mycorrhiza

16ba9409afc30ff6cf99f6aab07299a57992ba48 — Timur Ismagilov 1 year, 9 months ago a9eeccb master
Fix a Telegram-related bug

I removed my favorite comment:

// Problems is something we put blankets on.
2 files changed, 3 insertions(+), 2 deletions(-)

M auth/web.go
M user/net.go
M auth/web.go => auth/web.go +2 -1
@@ 170,8 170,9 @@ func handlerTelegramLogin(w http.ResponseWriter, rq *http.Request) {
			false,
		)
	)
	// If registering a user via Telegram failed, because a Telegram user with this name
	// has already registered, then everything is actually ok!
	if user.HasUsername(username) && user.ByName(username).Source == "telegram" {
		// Problems is something we put blankets on.
		err = nil
	}


M user/net.go => user/net.go +1 -1
@@ 59,7 59,7 @@ func Register(username, password, group, source string, force bool) error {
		return fmt.Errorf("username ā€˜%sā€™ is already taken", username)
	case !force && cfg.RegistrationLimit > 0 && Count() >= cfg.RegistrationLimit:
		return fmt.Errorf("reached the limit of registered users (%d)", cfg.RegistrationLimit)
	case password == "":
	case password == "" && source != "telegram":
		return fmt.Errorf("password must not be empty")
	}