mirror of https://github.com/procxx/kepka.git
				
				
				
			Handle AUTH_KEY_UNREGISTERED on password submit.
This commit is contained in:
		
							parent
							
								
									21fab77c4b
								
							
						
					
					
						commit
						7e104805c0
					
				| 
						 | 
					@ -148,20 +148,21 @@ void PwdCheckWidget::pwdSubmitFail(const RPCError &error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_sentRequest = 0;
 | 
						_sentRequest = 0;
 | 
				
			||||||
	stopCheck();
 | 
						stopCheck();
 | 
				
			||||||
	auto &err = error.type();
 | 
						const auto &type = error.type();
 | 
				
			||||||
	if (err == qstr("PASSWORD_HASH_INVALID")
 | 
						if (type == qstr("PASSWORD_HASH_INVALID")
 | 
				
			||||||
		|| err == qstr("SRP_PASSWORD_CHANGED")) {
 | 
							|| type == qstr("SRP_PASSWORD_CHANGED")) {
 | 
				
			||||||
		showError(langFactory(lng_signin_bad_password));
 | 
							showError(langFactory(lng_signin_bad_password));
 | 
				
			||||||
		_pwdField->selectAll();
 | 
							_pwdField->selectAll();
 | 
				
			||||||
		_pwdField->showError();
 | 
							_pwdField->showError();
 | 
				
			||||||
	} else if (err == qstr("PASSWORD_EMPTY")) {
 | 
						} else if (type == qstr("PASSWORD_EMPTY")
 | 
				
			||||||
 | 
							|| type == qstr("AUTH_KEY_UNREGISTERED")) {
 | 
				
			||||||
		goBack();
 | 
							goBack();
 | 
				
			||||||
	} else if (err == qstr("SRP_ID_INVALID")) {
 | 
						} else if (type == qstr("SRP_ID_INVALID")) {
 | 
				
			||||||
		handleSrpIdInvalid();
 | 
							handleSrpIdInvalid();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (Logs::DebugEnabled()) { // internal server error
 | 
							if (Logs::DebugEnabled()) { // internal server error
 | 
				
			||||||
			auto text = err + ": " + error.description();
 | 
								const auto text = type + ": " + error.description();
 | 
				
			||||||
			showError([text] { return text; });
 | 
								showError([=] { return text; });
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			showError(&Lang::Hard::ServerError);
 | 
								showError(&Lang::Hard::ServerError);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -235,22 +236,23 @@ void PwdCheckWidget::codeSubmitFail(const RPCError &error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_sentRequest = 0;
 | 
						_sentRequest = 0;
 | 
				
			||||||
	stopCheck();
 | 
						stopCheck();
 | 
				
			||||||
	const QString &err = error.type();
 | 
						const auto &type = error.type();
 | 
				
			||||||
	if (err == qstr("PASSWORD_EMPTY")) {
 | 
						if (type == qstr("PASSWORD_EMPTY")
 | 
				
			||||||
 | 
							|| type == qstr("AUTH_KEY_UNREGISTERED")) {
 | 
				
			||||||
		goBack();
 | 
							goBack();
 | 
				
			||||||
	} else if (err == qstr("PASSWORD_RECOVERY_NA")) {
 | 
						} else if (type == qstr("PASSWORD_RECOVERY_NA")) {
 | 
				
			||||||
		recoverStartFail(error);
 | 
							recoverStartFail(error);
 | 
				
			||||||
	} else if (err == qstr("PASSWORD_RECOVERY_EXPIRED")) {
 | 
						} else if (type == qstr("PASSWORD_RECOVERY_EXPIRED")) {
 | 
				
			||||||
		_emailPattern = QString();
 | 
							_emailPattern = QString();
 | 
				
			||||||
		onToPassword();
 | 
							onToPassword();
 | 
				
			||||||
	} else if (err == qstr("CODE_INVALID")) {
 | 
						} else if (type == qstr("CODE_INVALID")) {
 | 
				
			||||||
		showError(langFactory(lng_signin_wrong_code));
 | 
							showError(langFactory(lng_signin_wrong_code));
 | 
				
			||||||
		_codeField->selectAll();
 | 
							_codeField->selectAll();
 | 
				
			||||||
		_codeField->showError();
 | 
							_codeField->showError();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (Logs::DebugEnabled()) { // internal server error
 | 
							if (Logs::DebugEnabled()) { // internal server error
 | 
				
			||||||
			auto text = err + ": " + error.description();
 | 
								const auto text = type + ": " + error.description();
 | 
				
			||||||
			showError([text] { return text; });
 | 
								showError([=] { return text; });
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			showError(&Lang::Hard::ServerError);
 | 
								showError(&Lang::Hard::ServerError);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue